![]() |
ToyGine2 26.2.0
Game Engine for retro consoles
|
Output stream that appends formatted values into a toy::StringLike backend. More...
Public Types | |
| using | char_type = char |
| Type of characters stored in the string. | |
| using | pos_type = size_t |
| Type of positions in the string. | |
Public Member Functions | |
| constexpr | OStringStream () noexcept=default |
| Default constructor. | |
| template<StringLike SourceStringType> | |
| constexpr | OStringStream (const SourceStringType &string) noexcept |
| Constructs an OStringStream from a string-like object. | |
| constexpr void | swap (OStringStream &other) noexcept |
| Swaps the contents of this stream with another stream. | |
| constexpr OStringStream & | operator<< (bool value) noexcept |
| Inserts a boolean value into the stream. | |
| constexpr OStringStream & | operator<< (long value) noexcept |
| Inserts a signed long integer value into the stream. | |
| constexpr OStringStream & | operator<< (unsigned long value) noexcept |
| Inserts an unsigned long integer value into the stream. | |
| constexpr OStringStream & | operator<< (long long value) noexcept |
| Inserts a signed long long integer value into the stream. | |
| constexpr OStringStream & | operator<< (unsigned long long value) noexcept |
| Inserts an unsigned long long integer value into the stream. | |
| constexpr OStringStream & | operator<< (double value) noexcept |
| Inserts a double-precision floating-point value into the stream. | |
| constexpr OStringStream & | operator<< (const void *value) noexcept |
| Inserts a pointer value into the stream. | |
| constexpr OStringStream & | operator<< (nullptr_t) noexcept |
| Inserts a null pointer literal into the stream. | |
| constexpr OStringStream & | operator<< (short value) noexcept |
| Inserts a signed short integer value into the stream. | |
| constexpr OStringStream & | operator<< (int value) noexcept |
| Inserts a signed integer value into the stream. | |
| constexpr OStringStream & | operator<< (unsigned short value) noexcept |
| Inserts an unsigned short integer value into the stream. | |
| constexpr OStringStream & | operator<< (unsigned int value) noexcept |
| Inserts an unsigned integer value into the stream. | |
| constexpr OStringStream & | operator<< (float value) noexcept |
| Inserts a single-precision floating-point value into the stream. | |
| constexpr OStringStream & | operator<< (signed char value) noexcept |
| Inserts a signed 8-bit integer value into the stream. | |
| constexpr OStringStream & | operator<< (unsigned char value) noexcept |
| Inserts an unsigned 8-bit integer value into the stream. | |
| constexpr OStringStream & | operator<< (char_type value) noexcept |
| Inserts a single character into the stream. | |
| template<StringLike SourceStringType> | |
| constexpr OStringStream & | operator<< (const SourceStringType &value) noexcept |
| Inserts a string-like object into the stream. | |
| constexpr OStringStream & | operator<< (const char_type *value) noexcept |
| Inserts a C string into the stream. | |
| constexpr const StringType & | str () const noexcept |
| Returns a const reference to the underlying string. | |
| template<StringLike SourceStringType> | |
| constexpr void | str (const SourceStringType &string) noexcept |
| Sets the content of the stream from a string-like object. | |
| constexpr CStringView | view () const noexcept |
| Returns a non-owning view of the underlying string. | |
| constexpr OStringStream & | put (char_type character) noexcept |
| Appends a single character to the end of the stream. | |
| constexpr OStringStream & | write (const char_type *string, size_t count) noexcept |
| Writes a specified number of characters from a buffer to the stream. | |
| constexpr pos_type | tellp () const noexcept |
| Returns the current write position in the stream. | |
| constexpr size_t | precision () const noexcept |
| Returns the current floating-point precision setting. | |
| constexpr size_t | setPrecision (size_t newPrecision) noexcept |
| Sets the floating-point precision and returns the previous value. | |
| template<StringLike SourceStringType> | |
| constexpr OStringStream< StringType > & | operator<< (const SourceStringType &value) noexcept |
Private Attributes | |
| StringType | _string |
| Internal string storage for the stream content. | |
| size_t | _precision = 6 |
| Floating-point precision value used for number formatting. | |
Output stream that appends formatted values into a toy::StringLike backend.
OStringStream provides a std::ostringstream-like operator<< surface; allocation and capacity follow StringType (e.g. toy::FixedString). Integral, floating-point, boolean, pointer, character, C-string, and string-like inserts are supported where exposed by the template API.
| StringType | The type of the underlying storage. Must satisfy the toy::StringLike concept. |
noexcept; failed capacity is handled per StringType (typically debug assertions).precision() / setPrecision() affect subsequent floating inserts.operator<< forwards to string append or formatting helpers.noexcept.constexpr usage as implemented).| using toy::OStringStream< StringType >::char_type = char |
Type of characters stored in the string.
| using toy::OStringStream< StringType >::pos_type = size_t |
Type of positions in the string.
|
constexprdefaultnoexcept |
Default constructor.
|
explicitconstexprnoexcept |
Constructs an OStringStream from a string-like object.
This constructor initializes the stream by copying the content from a string-like object.
| SourceStringType | The type of the source string. Must satisfy the toy::StringLike concept. |
| string | The source string-like object to copy content from. |
|
constexprnoexcept |
Inserts a boolean value into the stream.
This operator converts the boolean value to its string representation and appends it to the stream. The value true is converted to the string "true", and the value false is converted to the string "false".
| value | The boolean value to insert into the stream. |
std::ostringstream::operator<<(bool).
|
constexprnoexcept |
Inserts a single character into the stream.
This operator appends the specified value character to the end of the stream. The character is added directly without any conversion or formatting.
| value | The character to insert into the stream. |
std::ostringstream::operator<<(char_type).
|
constexprnoexcept |
Inserts a C string into the stream.
This operator appends the content of a C string to the end of the stream. The string is copied and appended to the current stream content.
| value | The C string to insert into the stream. |
std::ostringstream::operator<<(const char*).
|
constexprnoexcept |
Inserts a string-like object into the stream.
This operator appends the content of a string-like object to the end of the stream. The string content is copied and appended to the current stream content.
| SourceStringType | The type of the source string. Must satisfy the toy::StringLike concept. |
| value | The string-like object to insert into the stream. |
std::ostringstream::operator<<(const std::string&).
|
constexprnoexcept |
|
constexprnoexcept |
Inserts a pointer value into the stream.
This operator converts the pointer value to its hexadecimal string representation with "0x" prefix and appends it to the stream. The value is zero-padded to the pointer width: 8 hex digits for 32-bit pointers, 16 for 64-bit, so the output length is fixed for a given platform (e.g. "0x00000000" or "0x0000000000000000").
| value | The pointer value to insert into the stream. |
std::ostringstream::operator<<(const void*).
|
constexprnoexcept |
Inserts a double-precision floating-point value into the stream.
This operator converts the double value to its decimal string representation with the current precision setting and appends it to the stream. The precision controls the number of digits displayed.
| value | The double-precision floating-point value to insert into the stream. |
std::ostringstream::operator<<(double).
|
constexprnoexcept |
Inserts a single-precision floating-point value into the stream.
This operator converts the float value to its decimal string representation with the current precision setting and appends it to the stream. The precision controls the number of digits displayed.
| value | The single-precision floating-point value to insert into the stream. |
std::ostringstream::operator<<(float).
|
constexprnoexcept |
Inserts a signed integer value into the stream.
This operator converts the signed integer value to its decimal string representation and appends it to the stream. Negative values are prefixed with a minus sign.
| value | The signed integer value to insert into the stream. |
std::ostringstream::operator<<(int).
|
constexprnoexcept |
Inserts a signed long long integer value into the stream.
This operator converts the signed long long integer value to its decimal string representation and appends it to the stream. Negative values are prefixed with a minus sign.
| value | The signed long long integer value to insert into the stream. |
std::ostringstream::operator<<(long long).
|
constexprnoexcept |
Inserts a signed long integer value into the stream.
This operator converts the signed long integer value to its decimal string representation and appends it to the stream. Negative values are prefixed with a minus sign.
| value | The signed long integer value to insert into the stream. |
std::ostringstream::operator<<(long).
|
constexprnoexcept |
Inserts a null pointer literal into the stream.
This operator inserts the string "nullptr" into the stream when a null pointer literal is provided. This provides a consistent and readable representation for null pointers.
std::ostringstream::operator<<(nullptr_t).
|
constexprnoexcept |
Inserts a signed short integer value into the stream.
This operator converts the signed short integer value to its decimal string representation and appends it to the stream. Negative values are prefixed with a minus sign.
| value | The signed short integer value to insert into the stream. |
std::ostringstream::operator<<(short).
|
constexprnoexcept |
Inserts a signed 8-bit integer value into the stream.
This operator converts the signed 8-bit integer value to its decimal string representation and appends it to the stream. Negative values are prefixed with a minus sign.
| value | The signed 8-bit integer value to insert into the stream. |
std::ostringstream::operator<<(signed char).
|
constexprnoexcept |
Inserts an unsigned 8-bit integer value into the stream.
This operator converts the unsigned 8-bit integer value to its decimal string representation and appends it to the stream.
| value | The unsigned 8-bit integer value to insert into the stream. |
std::ostringstream::operator<<(unsigned char).
|
constexprnoexcept |
Inserts an unsigned integer value into the stream.
This operator converts the unsigned integer value to its decimal string representation and appends it to the stream.
| value | The unsigned integer value to insert into the stream. |
std::ostringstream::operator<<(unsigned int).
|
constexprnoexcept |
Inserts an unsigned long long integer value into the stream.
This operator converts the unsigned long long integer value to its decimal string representation and appends it to the stream.
| value | The unsigned long long integer value to insert into the stream. |
std::ostringstream::operator<<(unsigned long long).
|
constexprnoexcept |
Inserts an unsigned long integer value into the stream.
This operator converts the unsigned long integer value to its decimal string representation and appends it to the stream.
| value | The unsigned long integer value to insert into the stream. |
std::ostringstream::operator<<(unsigned long).
|
constexprnoexcept |
Inserts an unsigned short integer value into the stream.
This operator converts the unsigned short integer value to its decimal string representation and appends it to the stream.
| value | The unsigned short integer value to insert into the stream. |
std::ostringstream::operator<<(unsigned short).
|
nodiscardconstexprnoexcept |
Returns the current floating-point precision setting.
This method returns the precision value that will be used for formatting floating-point numbers when writing to the stream. The precision specifies the number of digits to display.
|
constexprnoexcept |
Appends a single character to the end of the stream.
This method appends the specified character to the end of the underlying string storage. The character is added to the current content without replacing it.
| character | The character to append to the stream. |
|
constexprnoexcept |
Sets the floating-point precision and returns the previous value.
This method sets the precision value that will be used for formatting floating-point numbers when writing to the stream. The precision specifies the number of digits to display.
| newPrecision | The new precision value to set. |
|
nodiscardconstexprnoexcept |
Returns a const reference to the underlying string.
This method provides read-only access to the internal string storage.
|
constexprnoexcept |
Sets the content of the stream from a string-like object.
This method replaces the current content of the stream with the content from a string-like object.
| SourceStringType | The type of the source string. Must satisfy the toy::StringLike concept. |
| string | The source string-like object to set the content from. |
|
constexprnoexcept |
Swaps the contents of this stream with another stream.
This method exchanges the underlying string storage between this stream and the other stream. Both streams must have the same StringType template parameter.
| other | The stream to swap contents with. |
|
nodiscardconstexprnoexcept |
Returns the current write position in the stream.
This method returns the position where the next write operation will append data. Since OStringStream only supports appending operations (all writes go to the end), the write position always equals the number of characters currently in the stream, which is the same as the size of the underlying string.
str().size().
|
nodiscardconstexprnoexcept |
Returns a non-owning view of the underlying string.
This method creates and returns a toy::CStringView that provides read-only access to the underlying string storage without copying the content. The view is lightweight and does not own the string data.
|
constexprnoexcept |
Writes a specified number of characters from a buffer to the stream.
This method appends count characters from the buffer pointed to by string to the end of the stream. The characters are copied directly from the buffer without requiring null termination.
| string | The pointer to the character buffer to write from. Must not be null if count is greater than zero. |
| count | The number of characters to write from the buffer. |
|
private |
Floating-point precision value used for number formatting.
|
private |
Internal string storage for the stream content.