The non-GUI classes use many strings that will be changed from QString to std::string. In the Tester class, these strings are output using Qt text output streams. The next step in the STL transition was to change the Tester class to use std::ostream instead of QTextStream. This also required changes to the Command Line class, which provides the tester instance with the output stream to use for output.
The text stream member of the Command Line class (where either stdout or stderr was opened) was changed to a pointer to an std::ostream (which is now set to a pointer to either std::cout or std::cerr). The cout() member function was changed to return a reference to the output stream and allowing the output stream member to be set from is argument (defaulting to std::cout). Since nothing is opened, nothing needs to be closed so the coutClose() member function and destructor was removed.
Where ever a QString is output to the output stream, the toStdString() function was added since QString is not supported by std::ostream. This is temporary until most of the QString instances are changed to std::string. The usage string member was changed to a local std::string since no other code used it and it's access function was removed.
The text stream member of the Tester class was changed to an output stream reference. The toStdString() was added to QString instances (temporary). All uses of endl were changed to the new line character ('\n'). The endl manipulator (both Qt and STL) not only outputs the new line character, it also flushes the stream and this flush was not needed.
[branch stl commit 5cc2438dd0]
Monday, September 29, 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.)