regina::ShortOutput< T, supportsUtf8 > Struct Template Reference
Engine Structure

A common base class for objects that provide short text output only. More...

`#include <output.h>`

Inheritance diagram for regina::ShortOutput< T, supportsUtf8 >:

## 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...

## Detailed Description

### template<class T, bool supportsUtf8 = false>
struct regina::ShortOutput< T, supportsUtf8 >

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.

Template Parameters

  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().

Python:
  Not present, but the output routines str(), utf8() and detail() will be provided directly through the various subclasses.

## Member Function Documentation

## detail()

template<class T, bool supportsUtf8 = false>

std::string regina::Output< T, supportsUtf8 >::detail | ( |  | ) | const

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.

Returns
  a detailed text representation of this object.

## str()

template<class T, bool supportsUtf8 = false>

std::string regina::Output< T, supportsUtf8 >::str | ( |  | ) | const

inherited

Returns a short text representation of this object.

This text should be human-readable, should fit on a single line, and should not end with a newline. Where possible, it should use plain ASCII characters.

Python:
  In addition to str(), this is also used as the Python "stringification" function `__str__()`.

Returns
  a short text representation of this object.

## utf8()

template<class T, bool supportsUtf8 = false>

std::string regina::Output< T, supportsUtf8 >::utf8 | ( |  | ) | const

inherited

Returns a short text representation of this object using unicode characters.

Like str(), this text should be human-readable, should fit on a single line, and should not end with a newline. In addition, it may use unicode characters to make the output more pleasant to read. This string will be encoded in UTF-8.

Returns
  a short text representation of this object.

## writeTextLong()

template<class T , bool supportsUtf8>

void regina::ShortOutput< T, supportsUtf8 >::writeTextLong | ( | std::ostream & | out | ) | const

inline

A default implementation for detailed output.

This routine simply calls T::writeTextShort() and appends a final newline.

Python:
  Not present.

Parameters

  out | the output stream to which to write.

The documentation for this struct was generated from the following file:

- output.h

Copyright © 1999-2016, The Regina development team
This software is released under the GNU General Public License, with some additional permissions; see the source code for details.
For further information, or to submit a bug or other problem, please contact Ben Burton (bab@maths.uq.edu.au).