Text-output-formatting. More...
#include "itextstream.h"
#include <cctype>
#include <cstddef>
#include <cmath>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <glib.h>
#include <string>
#include "generic/arrayrange.h"
Go to the source code of this file.
Data Structures | |
class | HexChar |
class | FloatFormat |
class | Decimal |
HACK: I reduced sig fig from 10 to 7, because ufo2map only uses float no point in more than 7 sig fig. any change here must also be made in ufo2map .map writing code. blondandy. More... | |
class | Quoted< Type > |
class | LowerCase |
class | SingleCharacterInputStream< TextInputStreamType, SIZE > |
A wrapper for a TextInputStream optimised for reading a single character at a time. More... | |
class | SingleCharacterOutputStream |
A wrapper for a TextOutputStream, optimised for writing a single character at a time. More... | |
class | BufferedTextOutputStream< TextOutputStreamType, SIZE > |
A wrapper for a TextOutputStream, optimised for writing a few characters at a time. More... | |
Namespaces | |
namespace | TextOutputDetail |
Defines | |
#define | INCLUDED_STREAM_TEXTSTREAM_H |
Typedefs | |
typedef unsigned int | Unsigned |
Functions | |
char * | TextOutputDetail::write_unsigned_nonzero_decimal_backward (char *ptr, unsigned int decimal) |
char * | TextOutputDetail::write_signed_nonzero_decimal_backward (char *ptr, int decimal, bool show_positive) |
char * | TextOutputDetail::write_unsigned_nonzero_decimal_backward (char *ptr, unsigned int decimal, bool show_positive) |
char * | TextOutputDetail::write_signed_decimal_backward (char *ptr, int decimal, bool show_positive) |
char * | TextOutputDetail::write_unsigned_decimal_backward (char *ptr, unsigned int decimal, bool show_positive) |
template<typename TextOutputStreamType > | |
TextOutputStreamType & | ostream_write (TextOutputStreamType &ostream, char c) |
Writes a single character c to ostream . | |
template<typename TextOutputStreamType > | |
TextOutputStreamType & | ostream_write (TextOutputStreamType &ostream, const double d) |
Writes a double-precision floating point value d to ostream . HACK changed from g to %.7g to reduce pointless extra places - ufo2map only uses float for tex scale The value will be formatted either as decimal with trailing zeros removed, or with scientific 'e' notation, whichever is shorter. | |
template<typename TextOutputStreamType > | |
TextOutputStreamType & | ostream_write (TextOutputStreamType &ostream, const float f) |
Writes a single-precision floating point value f to ostream . The value will be formatted either as decimal with trailing zeros removed, or with scientific 'e' notation, whichever is shorter. | |
template<typename TextOutputStreamType > | |
TextOutputStreamType & | ostream_write (TextOutputStreamType &ostream, const int i) |
Writes a signed integer i to ostream in decimal form. A '-' sign will be added if the value is negative. | |
template<typename TextOutputStreamType > | |
TextOutputStreamType & | ostream_write (TextOutputStreamType &ostream, const Unsigned i) |
Writes an unsigned integer i to ostream in decimal form. | |
template<typename TextOutputStreamType > | |
TextOutputStreamType & | ostream_write (TextOutputStreamType &ostream, const char *string) |
Writes a null-terminated string to ostream . | |
template<typename TextOutputStreamType > | |
TextOutputStreamType & | ostream_write (TextOutputStreamType &ostream, const std::string &string) |
Writes a null-terminated string to ostream . | |
template<typename TextOutputStreamType > | |
TextOutputStreamType & | ostream_write (TextOutputStreamType &ostream, const HexChar &c) |
Writes a single character c to ostream in hexadecimal form. | |
template<typename TextOutputStreamType > | |
TextOutputStreamType & | ostream_write (TextOutputStreamType &ostream, const FloatFormat &formatted) |
Writes a floating point value to ostream with a specific width and precision. | |
template<typename TextOutputStreamType > | |
TextOutputStreamType & | ostream_write (TextOutputStreamType &ostream, const Decimal &decimal) |
Writes a floating point value to ostream in decimal form with trailing zeros removed. | |
template<typename TextOutputStreamType > | |
TextOutputStreamType & | ostream_write (TextOutputStreamType &ostream, const StringRange &range) |
Writes a range of characters to ostream . | |
template<typename Type > | |
Quoted< Type > | makeQuoted (const Type &type) |
template<typename TextOutputStreamType , typename Type > | |
TextOutputStreamType & | ostream_write (TextOutputStreamType &ostream, const Quoted< Type > "ed) |
Writes any type to ostream with a quotation mark character before and after it. | |
template<typename TextOutputStreamType > | |
TextOutputStreamType & | ostream_write (TextOutputStreamType &ostream, const LowerCase &lower) |
Writes a string to ostream converted to lower-case. |
Text-output-formatting.
Definition in file textstream.h.
#define INCLUDED_STREAM_TEXTSTREAM_H |
Definition at line 23 of file textstream.h.
typedef unsigned int Unsigned |
Definition at line 154 of file textstream.h.
Quoted<Type> makeQuoted | ( | const Type & | type | ) | [inline] |
Definition at line 268 of file textstream.h.
Referenced by CGameDescription::getRequiredKeyValue().
TextOutputStreamType& ostream_write | ( | TextOutputStreamType & | ostream, | |
const LowerCase & | lower | |||
) | [inline] |
Writes a string to ostream
converted to lower-case.
Definition at line 288 of file textstream.h.
References LowerCase::m_string.
TextOutputStreamType& ostream_write | ( | TextOutputStreamType & | ostream, | |
const Quoted< Type > & | quoted | |||
) | [inline] |
Writes any type to ostream
with a quotation mark character before and after it.
Definition at line 274 of file textstream.h.
References Quoted< Type >::m_type.
TextOutputStreamType& ostream_write | ( | TextOutputStreamType & | ostream, | |
const StringRange & | range | |||
) | [inline] |
Writes a range
of characters to ostream
.
Definition at line 253 of file textstream.h.
References ArrayRange< Element >::first, and ArrayRange< Element >::last.
TextOutputStreamType& ostream_write | ( | TextOutputStreamType & | ostream, | |
const Decimal & | decimal | |||
) | [inline] |
Writes a floating point value to ostream
in decimal form with trailing zeros removed.
Definition at line 242 of file textstream.h.
References Decimal::m_f.
TextOutputStreamType& ostream_write | ( | TextOutputStreamType & | ostream, | |
const FloatFormat & | formatted | |||
) | [inline] |
Writes a floating point value to ostream
with a specific width and precision.
Definition at line 223 of file textstream.h.
References FloatFormat::m_f, FloatFormat::m_precision, and FloatFormat::m_width.
TextOutputStreamType& ostream_write | ( | TextOutputStreamType & | ostream, | |
const HexChar & | c | |||
) | [inline] |
Writes a single character c
to ostream
in hexadecimal form.
Definition at line 204 of file textstream.h.
References HexChar::m_value.
TextOutputStreamType& ostream_write | ( | TextOutputStreamType & | ostream, | |
const std::string & | string | |||
) | [inline] |
Writes a null-terminated string
to ostream
.
Definition at line 190 of file textstream.h.
TextOutputStreamType& ostream_write | ( | TextOutputStreamType & | ostream, | |
const char * | string | |||
) | [inline] |
Writes a null-terminated string
to ostream
.
Definition at line 183 of file textstream.h.
TextOutputStreamType& ostream_write | ( | TextOutputStreamType & | ostream, | |
const Unsigned | i | |||
) | [inline] |
Writes an unsigned integer i
to ostream
in decimal form.
Definition at line 158 of file textstream.h.
References TextOutputDetail::write_unsigned_decimal_backward().
TextOutputStreamType& ostream_write | ( | TextOutputStreamType & | ostream, | |
const int | i | |||
) | [inline] |
Writes a signed integer i
to ostream
in decimal form. A '-' sign will be added if the value is negative.
Definition at line 146 of file textstream.h.
References TextOutputDetail::write_signed_decimal_backward().
TextOutputStreamType& ostream_write | ( | TextOutputStreamType & | ostream, | |
const float | f | |||
) | [inline] |
Writes a single-precision floating point value f
to ostream
. The value will be formatted either as decimal with trailing zeros removed, or with scientific 'e' notation, whichever is shorter.
Definition at line 139 of file textstream.h.
References ostream_write().
TextOutputStreamType& ostream_write | ( | TextOutputStreamType & | ostream, | |
const double | d | |||
) | [inline] |
Writes a double-precision floating point value d
to ostream
. HACK changed from g to %.7g to reduce pointless extra places - ufo2map only uses float for tex scale The value will be formatted either as decimal with trailing zeros removed, or with scientific 'e' notation, whichever is shorter.
Definition at line 129 of file textstream.h.
TextOutputStreamType& ostream_write | ( | TextOutputStreamType & | ostream, | |
char | c | |||
) | [inline] |
Writes a single character c
to ostream
.
Definition at line 120 of file textstream.h.