There is a debug text function in the Program Model class used for the temporary program view in the GUI and by the tester class. This function used two functions from the Program Word class, the instruction debug text (for instruction words) and operand debug text (for operand words).
The debug text function was modified to return a standard string. To implement the building of the string, an standard output string stream is used, which make it easy to build up the string especially for numeric data types (the QString::arg function was being used for this purpose). Once done, the string of the output stream is returned.
Since an output stream is being used, it made sense to make the instruction debug text function an overloaded output stream operator. This function only used access functions of the program word, so it didn't need to be a member of the program class (or a friend function).
The operand debug text function only contained a single line and also used a program word access function, so it also didn't need to be a member of the program word class. It was passed the text to output with the operand integer value, and was only used by the debug text function, so it made sense to remove this function and just do the functionality directly in the debug text function.
[branch misc-cpp-stl commit 645eff8d1f]
Thursday, November 13, 2014
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
All comments and feedback welcomed, whether positive or negative.
(Anonymous comments are allowed, but comments with URL links or unrelated comments will be removed.)