Regina Calculation Engine
|
A common base class for objects that provide short text output only. More...
#include <output.h>
Public Member Functions | |
void | writeTextLong (std::ostream &out) const |
A default implementation for detailed output. More... | |
std::string | str () const |
Returns a short text representation of this object. More... | |
std::string | utf8 () const |
Returns a short text representation of this object using unicode characters. More... | |
std::string | detail () const |
Returns a detailed text representation of this object. More... | |
A common base class for objects that provide short text output only.
All classes that provide human-readable text output should ultimately inherit from Output, which provides support for short output (both with and without unicode support) as well as detailed output. However, if your class is simple and has no need for detailed output, then you may inherit from ShortOutput instead.
If you inherit from this class, then you only need to provide a single function writeTextShort(), as described in the Output class notes. You do not need to provide writeTextLong(); this class will implement it for you.
As with Output, this class will provide three routines str(), utf8() and detail(). The function detail() will return the same output as str(), but with a final newline added.
T | the class that provides the implementation of writeTextShort(). Typically this will be your own class (i.e., your class C derives from ShortOutput<C>). However, this may be deeper in the class hierarchy. |
supportsUtf8 | true if the class T can make use of the richer unicode character set, or false if the short and utf8 outputs are identical. If this is false then T::writeTextShort() will only ever be called in the form writeTextShort(std::ostream&) , and you may for simplicity omit the second boolean utf8 argument. This ShortOutput base class will still provide a utf8() function, but it will return the same output as short(). |