bn::ostringstream class

Implements output operations on string based streams.

It effectively stores an instance of istring_base and performs output operations to it.

Constructors, destructors, conversion operators

ostringstream(istring_base& string) explicit
Constructor.

Public functions

auto str() const -> const istring&
Returns a const reference to the managed string.
auto str() -> istring&
Returns a reference to the managed string.
auto rdbuf() const -> const istring*
Returns a const pointer to the managed string.
auto rdbuf() -> istring*
Returns a pointer to the managed string.
auto rdbuf(istring_base* sb) -> istring*
Sets the managed string.
void set_rdbuf(istring_base& sb)
Sets the managed string.
auto precision() const -> int
Returns the decimal precision of fixed point operations.
auto precision(int new_precision) -> int
Sets the decimal precision of fixed point operations.
void set_precision(int precision)
Sets the decimal precision of fixed point operations.
auto view() const -> string_view
Returns a view over the contents of the managed string.
auto size() const -> int
Returns the number of characters in the managed string.
auto length() const -> int
Returns the number of characters in the managed string.
auto max_size() const -> int
Returns the maximum possible number of characters in the managed string.
auto available() const -> int
Returns the remaining characters capacity in the managed string.
auto empty() const -> bool
Indicates if the managed string doesn't contain any character.
auto full() const -> bool
Indicates if the managed string can't contain any more characters.
void append(char character)
Appends an additional character to the managed string.
auto put(char character) -> ostringstream&
Appends an additional character to the managed string.
void append(const string_view& view)
Appends additional characters to the managed string.
void append(const istring_base& string)
Appends additional characters to the managed string.
void append(const char* char_array_ptr)
Appends additional characters to the managed string.
void append(const char* char_array_ptr, int char_array_size)
Appends additional characters to the managed string.
auto write(const char* char_array_ptr, int char_array_size) -> ostringstream&
Appends additional characters to the managed string.
template<int MaxSize>
void append(char(&char_array)[MaxSize])
Appends additional characters to the managed string.
void append(bool value)
Appends the character representation of the given bool value to the managed string.
void append(int value)
Appends the character representation of the given int value to the managed string.
void append(long value)
Appends the character representation of the given long value to the managed string.
void append(int64_t value)
Appends the character representation of the given int64_t value to the managed string.
void append(unsigned value)
Appends the character representation of the given unsigned value to the managed string.
void append(unsigned long value)
Appends the character representation of the given unsigned long value to the managed string.
void append(uint64_t value)
Appends the character representation of the given uint64_t value to the managed string.
void append(const void* ptr)
Appends the character representation of the given pointer to the managed string.
void append(] const nullptr_t& null_ptr)
Appends the character representation of the given null pointer to the managed string.
template<int Precision>
void append(fixed_t<Precision> value)
Appends the character representation of the given fixed point value to the managed string.
template<typename Type, typename... Args>
void append_args(const Type& value, const Args&... args)
Appends the character representation of the given parameters to the managed string.
template<typename Type>
void append_args(const Type& value)
Appends the character representation of the given value to the managed string.
void swap(ostringstream& other)
Exchanges the contents of this ostringstream with those of the other one.

Friends

void swap(ostringstream& a, ostringstream& b)
Exchanges the contents of a ostringstream with those of another one.

Function documentation

bn::ostringstream::ostringstream(istring_base& string) explicit

Constructor.

Parameters
string string in which to append to.

istring* bn::ostringstream::rdbuf(istring_base* sb)

Sets the managed string.

Parameters
sb Pointer to new string to manage.
Returns Pointer to new string to manage.

void bn::ostringstream::set_rdbuf(istring_base& sb)

Sets the managed string.

Parameters
sb Reference to new string to manage.

int bn::ostringstream::precision(int new_precision)

Sets the decimal precision of fixed point operations.

Parameters
new_precision New decimal precision.
Returns New decimal precision.

void bn::ostringstream::set_precision(int precision)

Sets the decimal precision of fixed point operations.

Parameters
precision New decimal precision.

void bn::ostringstream::append(char character)

Appends an additional character to the managed string.

Parameters
character Character to append.

ostringstream& bn::ostringstream::put(char character)

Appends an additional character to the managed string.

Parameters
character Character to append.

void bn::ostringstream::append(const string_view& view)

Appends additional characters to the managed string.

Parameters
view string_view to append.

void bn::ostringstream::append(const istring_base& string)

Appends additional characters to the managed string.

Parameters
string string to append.

void bn::ostringstream::append(const char* char_array_ptr)

Appends additional characters to the managed string.

Parameters
char_array_ptr Pointer to null-terminated characters array.

void bn::ostringstream::append(const char* char_array_ptr, int char_array_size)

Appends additional characters to the managed string.

Parameters
char_array_ptr Pointer to characters array.
char_array_size Characters count of the characters array.

ostringstream& bn::ostringstream::write(const char* char_array_ptr, int char_array_size)

Appends additional characters to the managed string.

Parameters
char_array_ptr Pointer to characters array.
char_array_size Characters count of the characters array.
Returns Reference to this.

template<int MaxSize>
void bn::ostringstream::append(char(&char_array)[MaxSize])

Appends additional characters to the managed string.

Parameters
char_array Non empty const characters array.

void bn::ostringstream::swap(ostringstream& other)

Exchanges the contents of this ostringstream with those of the other one.

Parameters
other ostringstream to exchange the contents with.

void swap(ostringstream& a, ostringstream& b)

Exchanges the contents of a ostringstream with those of another one.

Parameters
a First ostringstream to exchange the contents with.
b Second ostringstream to exchange the contents with.