A class for converting stream objects to string values.
More...
#include <string_builder.h>
A class for converting stream objects to string values.
Several sydevs classes overload the operator<<
to append a textual representation of the class instance to a std::ostream
object. The string_builder
class provides a convenient way to convert these std::ostream
objects into std::string
values without requiring additional lines of code. Primitives and other classes can also be converted to strings.
string_builder()
Constructs a string_builder object.
Definition: string_builder.h:67
◆ string_builder() [1/3]
sydevs::string_builder::string_builder |
( |
| ) |
|
|
inline |
◆ string_builder() [2/3]
◆ string_builder() [3/3]
◆ ~string_builder()
sydevs::string_builder::~string_builder |
( |
| ) |
|
|
default |
◆ operator<<()
template<class T >
string_builder & sydevs::string_builder::operator<< |
( |
T const & |
value | ) |
|
|
inline |
Inserts data into the stream.
If an operation such as operator<<(std::ostream&, const T&)
is defined for type T
, then a copy of the information in value
is inserted into the string_builder
object for later retrieval via str()
.
- Parameters
-
value | The value to be inserted. |
- Returns
- A reference to the
string_builder
object, allowing multiple values to be inserted in a single line.
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ str()
std::string sydevs::string_builder::str |
( |
| ) |
const |
|
inline |
Obtains the data stored in the string_builder
object as a std::string
.
The documentation for this class was generated from the following file: