Base Framework
|
#include <base/string/FormatOutputStream.h>
Inherits BufferedOutputStream.
Inherited by StringOutputStream, and WideStringOutputStream.
Classes | |
class | Context |
Context of format output stream object. More... | |
class | GetContext |
class | Indent |
class | Manipulator |
class | PushContext |
Push and pop default context of format output stream. More... | |
class | SetContext |
class | SourceCodeLocation |
class | StringManipulator |
class | Symbols |
class | TabIndent |
Public Types | |
typedef SpinLock | Guard |
Public Member Functions | |
FormatOutputStream (OutputStream &out, unsigned int size=DEFAULT_BUFFER_SIZE) | |
FormatOutputStream (const FormatOutputStream ©)=delete | |
void | reset () noexcept |
bool | isANSITerminal () |
FormatOutputStream & | setRadixPosition (unsigned int position) noexcept |
FormatOutputStream & | setJustification (Symbols::Justification justification) noexcept |
FormatOutputStream & | setWidth (unsigned int width) noexcept |
FormatOutputStream & | setPrecision (unsigned int precision) noexcept |
FormatOutputStream & | setDateFormat (const String &format) |
void | setLocale (const Locale &locale) noexcept |
unsigned int | getFlags () const noexcept |
void | setFlags (unsigned int flags) noexcept |
Symbols::Base | getBase () const noexcept |
Symbols::Base | getRealBase () const noexcept |
unsigned int | getWidth () const noexcept |
unsigned int | getPrecision () const noexcept |
FormatOutputStream & | operator<< (Action action) |
FormatOutputStream & | operator<< (Indent indent) |
FormatOutputStream & | operator<< (TabIndent indent) |
void | indent (unsigned int size, bool useTab=false) |
void | addCharacterField (const char *buffer, MemorySize size) |
void | addCharacterField (const wchar *buffer, MemorySize size) |
void | addCharacterField (const char16_t *buffer, MemorySize size) |
void | addCharacterField (const char32_t *buffer, MemorySize size) |
void | addIntegerField (const char *buffer, MemorySize size, bool isSigned) |
void | addDateField (const Date &date) |
void | writeFloatingPointType (unsigned int significant, unsigned int *mantissa, unsigned int mantissaSize, int base2Exponent, unsigned int valueFlags) |
FormatOutputStream & | getContext (Context &context) noexcept |
FormatOutputStream & | setContext (const Context &context) noexcept |
FormatOutputStream & | operator<< (const SourceCodeLocation &location) |
template<MemorySize SIZE> | |
FormatOutputStream & | operator<< (const char(&literal)[SIZE]) |
FormatOutputStream & | operator<< (bool value) |
FormatOutputStream & | operator<< (char value) |
FormatOutputStream & | operator<< (wchar value) |
FormatOutputStream & | operator<< (short int value) |
FormatOutputStream & | operator<< (unsigned short int value) |
FormatOutputStream & | operator<< (int value) |
FormatOutputStream & | operator<< (unsigned int value) |
FormatOutputStream & | operator<< (long value) |
FormatOutputStream & | operator<< (unsigned long value) |
FormatOutputStream & | operator<< (long long value) |
FormatOutputStream & | operator<< (unsigned long long value) |
FormatOutputStream & | operator<< (int128 value) |
FormatOutputStream & | operator<< (uint128 value) |
FormatOutputStream & | operator<< (float value) |
FormatOutputStream & | operator<< (double value) |
FormatOutputStream & | operator<< (long double value) |
FormatOutputStream & | operator<< (float128 value) |
FormatOutputStream & | operator<< (const NativeString &value) |
FormatOutputStream & | operator<< (const NativeWideString &value) |
FormatOutputStream & | operator<< (const char *value) |
FormatOutputStream & | operator<< (const wchar *value) |
FormatOutputStream & | operator<< (const char16_t *value) |
FormatOutputStream & | operator<< (const char32_t *value) |
FormatOutputStream & | operator<< (const MemorySpan &span) |
FormatOutputStream & | operator<< (const void *value) |
template<class TYPE > | |
FormatOutputStream & | operator<< (Reference< TYPE > value) |
FormatOutputStream & | operator<< (const Literal &literal) |
FormatOutputStream & | operator<< (const WideLiteral &literal) |
FormatOutputStream & | operator<< (const Exception &e) |
virtual String | toString () |
~FormatOutputStream () | |
![]() | |
BufferedOutputStream (OutputStream &out, unsigned int size=DEFAULT_BUFFER_SIZE) | |
void | flush () |
unsigned int | write (const uint8 *buffer, unsigned int size, bool nonblocking=false) |
void | unfoldValue (char value, unsigned int count) |
~BufferedOutputStream () | |
![]() | |
FilterOutputStream (OutputStream &out) | |
OutputStream & | getOutputStream () noexcept |
void | close () |
void | flush () |
unsigned int | write (const uint8 *buffer, unsigned int size, bool nonblocking=false) |
![]() | |
virtual | ~Stream () noexcept(false) |
![]() | |
ReferenceCountedObject () noexcept | |
ReferenceCountedObject (const ReferenceCountedObject ©) noexcept | |
ReferenceCountedObject (ReferenceCountedObject &&move) noexcept | |
ReferenceCountedObject & | operator= (const ReferenceCountedObject ©) noexcept |
ReferenceCountedObject & | operator= (ReferenceCountedObject &&move) noexcept |
MemorySize | getNumberOfReferences_INTERNAL () const noexcept |
virtual bool | useGarbageCollector () const noexcept |
![]() | |
DynamicObject () noexcept | |
bool | isValidObject () const noexcept |
virtual | ~DynamicObject () noexcept(false) |
_COM_AZURE_DEV__BASE__OVERRIDE_ALLOC () | |
Static Public Attributes | |
static const unsigned int | DEFAULT_FLAGS |
static const Symbols::EndOfLine | DEFAULT_EOL = Symbols::UNIXEOL |
static const Symbols::Base | DEFAULT_INTEGER_BASE = Symbols::DECIMAL |
static const Symbols::Base | DEFAULT_REAL_BASE = Symbols::DECIMAL |
static const Symbols::RealStyle | DEFAULT_REAL_STYLE = Symbols::FIXED |
static const int | DEFAULT_RADIX_POSITION = 0 |
static const Symbols::MajorDateFormat | DEFAULT_MAJOR_DATE_FORMAT |
static const Symbols::NamedDateFormat | DEFAULT_NAMED_DATE_FORMAT |
static const Symbols::Justification | DEFAULT_JUSTIFICATION |
static const int | DEFAULT_WIDTH = 0 |
static const int | DEFAULT_PRECISION = 6 |
static constexpr unsigned int | MAXIMUM_WIDTH = 128 |
static constexpr unsigned int | MAXIMUM_PRECISION = 64 |
static constexpr unsigned int | MAXIMUM_SIZE = 256 |
![]() | |
static const unsigned int | DEFAULT_BUFFER_SIZE = 4096 |
static const unsigned int | MINIMUM_BUFFER_SIZE = 1024 |
Protected Attributes | |
Guard | guard |
Context | defaultContext |
Context | context |
![]() | |
Allocator< uint8 > | buffer |
unsigned int | writeHead = 0 |
unsigned int | readHead = 0 |
![]() | |
OutputStream & | out |
Static Protected Attributes | |
static const Context | DEFAULT_CONTEXT |
Related Functions | |
(Note that these are not member functions.) | |
enum | Action |
Format output stream.
Stream used to stringify types.
typedef SpinLock FormatOutputStream::Guard |
The type of the guard.
FormatOutputStream::FormatOutputStream | ( | OutputStream & | out, |
unsigned int | size = DEFAULT_BUFFER_SIZE |
||
) |
Initializes the format output stream.
out | The output stream. |
size | The size of the buffer. Default is given by DEFAULT_BUFFER_SIZE. |
FormatOutputStream::~FormatOutputStream | ( | ) |
Destroy format output stream.
void FormatOutputStream::addCharacterField | ( | const char * | buffer, |
MemorySize | size | ||
) |
Writes the specifies number of characters to the stream.
void FormatOutputStream::addCharacterField | ( | const char16_t * | buffer, |
MemorySize | size | ||
) |
Writes the specifies number of characters to the stream.
void FormatOutputStream::addCharacterField | ( | const char32_t * | buffer, |
MemorySize | size | ||
) |
Writes the specifies number of characters to the stream.
void FormatOutputStream::addCharacterField | ( | const wchar * | buffer, |
MemorySize | size | ||
) |
Writes the specifies number of characters to the stream.
void FormatOutputStream::addDateField | ( | const Date & | date | ) |
Writes a date object to the stream.
void FormatOutputStream::addIntegerField | ( | const char * | buffer, |
MemorySize | size, | ||
bool | isSigned | ||
) |
Writes a preformated integer to the stream.
|
inlinenoexcept |
Returns the current integer base.
|
noexcept |
Gets the context.
|
inlinenoexcept |
Returns the flags for the next field.
|
inlinenoexcept |
Returns the current precision.
|
inlinenoexcept |
Returns the current floating-point base.
|
inlinenoexcept |
Returns the current field width.
void FormatOutputStream::indent | ( | unsigned int | size, |
bool | useTab = false |
||
) |
Writes the specified number of spaces to the stream. The current context is ignored and not reset by this method.
bool FormatOutputStream::isANSITerminal | ( | ) |
Returns true if the stream is connected to an ANSI terminal.
FormatOutputStream& FormatOutputStream::operator<< | ( | Action | action | ) |
Send action to stream.
|
inline |
Write value to stream.
|
inline |
Writes the given string literal to the stream.
literal | String literal. |
|
inline |
Write value to stream.
|
inline |
Write value to stream.
FormatOutputStream& FormatOutputStream::operator<< | ( | const Exception & | e | ) |
Writes a nice description of the exception to the format output stream.
|
inline |
Writes a string literal to a format output stream.
|
inline |
Writes the memory span to the stream.
|
inline |
Write value to stream.
|
inline |
Write value to stream.
FormatOutputStream& FormatOutputStream::operator<< | ( | const SourceCodeLocation & | location | ) |
Writes the debug information to the stream.
FormatOutputStream& FormatOutputStream::operator<< | ( | const void * | value | ) |
Writes a pointer to a format output stream.
|
inline |
Write value to stream.
FormatOutputStream& FormatOutputStream::operator<< | ( | double | value | ) |
Write value to stream.
FormatOutputStream& FormatOutputStream::operator<< | ( | float | value | ) |
Write value to stream.
FormatOutputStream& FormatOutputStream::operator<< | ( | float128 | value | ) |
Write value to stream.
|
inline |
Indents the stream with the specified number of spaces. This is usually used immediately after an EOL.
FormatOutputStream& FormatOutputStream::operator<< | ( | int | value | ) |
Write value to stream.
FormatOutputStream& FormatOutputStream::operator<< | ( | int128 | value | ) |
Write value to stream.
FormatOutputStream& FormatOutputStream::operator<< | ( | long double | value | ) |
Write value to stream.
FormatOutputStream& FormatOutputStream::operator<< | ( | long long | value | ) |
Write value to stream.
FormatOutputStream& FormatOutputStream::operator<< | ( | long | value | ) |
Write value to stream.
|
inline |
Writes a reference to a format output stream.
FormatOutputStream& FormatOutputStream::operator<< | ( | short int | value | ) |
Write value to stream.
|
inline |
Indents the stream with the specified number of TABs. This is usually used immediately after an EOL.
FormatOutputStream& FormatOutputStream::operator<< | ( | uint128 | value | ) |
Write value to stream.
FormatOutputStream& FormatOutputStream::operator<< | ( | unsigned int | value | ) |
Write value to stream.
FormatOutputStream& FormatOutputStream::operator<< | ( | unsigned long long | value | ) |
Write value to stream.
FormatOutputStream& FormatOutputStream::operator<< | ( | unsigned long | value | ) |
Write value to stream.
FormatOutputStream& FormatOutputStream::operator<< | ( | unsigned short int | value | ) |
Write value to stream.
|
noexcept |
Resets context flags.
|
noexcept |
Sets the context.
FormatOutputStream& FormatOutputStream::setDateFormat | ( | const String & | format | ) |
Sets the date format.
format | The desired date format. |
|
inlinenoexcept |
Sets the flags for the next field.
|
noexcept |
Sets the value justification within the field.
justification | The desired justification. |
|
noexcept |
Sets the locale of the stream. The locale is global for the stream. The stream uses POSIX formatting until the locale is set explicitly using this method. The action POSIX can be used to override the locale (see ISO/IEC WG14 N884, NCITS J11/99-019).
locale | The desired locale. |
|
noexcept |
Sets the precision for floating-point numbers (i.e. the number of digits after the decimal-point). The requested precision is silently reduced to MAXIMUM_PRECISION.
precision | The desired precision. |
|
noexcept |
Sets the desired position of the decimal-point within the field. Please note that the position is only advisory. Please note that this method sets the justification state to Symbols::RADIX as a side effect.
position | The desired position. |
|
noexcept |
Sets the current field width. The width silently reduced to MAXIMUM_WIDTH.
width | The desired width. |
|
virtual |
Returns the associated buffer as a String if supported by stream. E.g. StringOutputStream. Returns empty String otherwise. Stream is restarted for new content.
Reimplemented in WideStringOutputStream, and StringOutputStream.
void FormatOutputStream::writeFloatingPointType | ( | unsigned int | significant, |
unsigned int * | mantissa, | ||
unsigned int | mantissaSize, | ||
int | base2Exponent, | ||
unsigned int | valueFlags | ||
) |
Writes a preformated floating point value to stream.
|
related |
Actions used to modify a format output stream. Use BIN, OCT, DEC, and HEX to select an appropriate integer base. Use ZEROPAD and NOZEROPAD to enable/disable zero padding. Use PREFIX and NOPREFIX to enable/disable prefixes for numbers. EOL writes a new line to the stream. FLUSH forces the internal buffers to be flushed. Use ENDL to both write a new line and flush the internal buffers.
|
protected |
The current context.
|
staticprotected |
The initial context.
|
static |
|
static |
|
static |
|
static |
|
protected |
The current default context.
|
protected |
Guard.
|
staticconstexpr |
Specifies the maximum precision.
|
staticconstexpr |
Specifies the maximum number of characters for real numbers.
|
staticconstexpr |
Specifies the maximum field width.