Regina 7.3 Calculation Engine
|
A common base class for objects that provide short text output only. More...
#include <core/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(). |
|
inherited |
Returns a detailed text representation of this object.
This text may span many lines, and should provide the user with all the information they could want. It should be human-readable, should not contain extremely long lines (which cause problems for users reading the output in a terminal), and should end with a final newline. There are no restrictions on the underlying character set.
|
inherited |
Returns a short text representation of this object.
This text should be human-readable, should use plain ASCII characters where possible, and should not contain any newlines.
Within these limits, this short text ouptut should be as information-rich as possible, since in most cases this forms the basis for the Python __str__()
and __repr__()
functions.
__str__()
will use precisely this function, and for most classes the Python __repr__()
function will incorporate this into its output.
|
inherited |
Returns a short text representation of this object using unicode characters.
Like str(), this text should be human-readable, should not contain any newlines, and (within these constraints) should be as information-rich as is reasonable.
Unlike str(), this function may use unicode characters to make the output more pleasant to read. The string that is returned will be encoded in UTF-8.
|
inline |
A default implementation for detailed output.
This routine simply calls T::writeTextShort() and appends a final newline.
out | the output stream to which to write. |