DUECA/DUSIME
|
"Smart" string class. More...
#include <smartstring.hxx>
Classes | |
struct | json_string_writer |
Helper struct to create a json writer. More... | |
struct | xml_string_writer |
Helper struct to use an std::string as buffer for XML writing with pugi. More... | |
Public Member Functions | |
smartstring () | |
Constructor, default. | |
smartstring (const char *s) | |
Constructor from char*. | |
smartstring (const char *s, size_t n) | |
Constructor from char* and size limit. | |
smartstring (AmorphReStore &s) | |
Constructor with an AmorphReStore, for unpacking. | |
smartstring (const std::string &o) | |
Copy constructor. | |
smartstring (const smartstring &o) | |
Copy constructor. | |
smartstring (size_t n, char c) | |
Fill constructor. | |
smartstring & | operator= (const char *o) |
Assignment operator, with const char*. | |
smartstring & | operator= (const smartstring &o) |
Assignment operator, with another smartstring. | |
smartstring & | operator= (const std::string &o) |
Assignment, from a standard string. | |
~smartstring () | |
Destructor. | |
template<class DCO > | |
void | decodexml (DCO &obj) const |
Decode the XML in the string to the given DCO object. | |
template<class DCO > | |
void | encodexml (const DCO &obj) |
Encode the given DCO object as XML in this string. | |
template<class DCO > | |
void | decodejson (DCO &obj) const |
Decode the JSON in the string to the given DCO object. | |
template<class DCO > | |
void | encodejson (const DCO &obj) |
Encode the given DCO object as JSON in this string. | |
"Smart" string class.
This class adds facilities for coding and decoding DCO objects to and from JSON or XML in the string. This string class can be used in DCO objects, to provide an easy means to wrap other DCO objects or data, e.g., to provide initialization.
Decode the XML in the string to the given DCO object.
DCO | Dueca Communication Object, or comparable |
obj | DCO object |
smartdecodeerror | for type or dataclass mis-matches |
Encode the given DCO object as XML in this string.
DCO | Dueca Communication Object, or comparable |
obj | DCO object |
Decode the JSON in the string to the given DCO object.
DCO | Dueca Communication Object, or comparable |
obj | DCO object |
smartdecodeerror | When JSON cannot be parsed |
Encode the given DCO object as JSON in this string.
DCO | Dueca Communication Object, or comparable |
obj | DCO object |