Simple serializer which serials every given type into the following format: (The type needs to be convertable into a string via cxx::convert::toString) LENGTH:DATALENGTH:DATA... Example: Serializes "hello", 123, 123.01 into 5:hello3:1236:123.01.
More...
|
| Serialization (const std::string &value) noexcept |
| Creates a serialization object from a given raw serialization. More...
|
|
std::string | toString () const noexcept |
| string conversion operator, returns the raw serialized string More...
|
|
| operator std::string () const noexcept |
| string conversion operator, returns the raw serialized string More...
|
|
template<typename T , typename... Targs> |
bool | extract (T &t, Targs &... args) const noexcept |
| Extracts the values from the serialization and writes them into the the given args, if one value is not convertable it returns false (e.g. convert "hello" to an integer) It also returns false if the underlying serialization string has a wrong syntax. More...
|
|
template<typename T > |
bool | getNth (const unsigned int index, T &t) const noexcept |
| Extracts the value at index and writes it into t. If the conversion failed it returns false It also returns false if the underlying serialization string has a wrong syntax. More...
|
|
Simple serializer which serials every given type into the following format: (The type needs to be convertable into a string via cxx::convert::toString) LENGTH:DATALENGTH:DATA... Example: Serializes "hello", 123, 123.01 into 5:hello3:1236:123.01.
std::cout << serial.toString() << std::endl;
std::string v1;
int v2;
float v3;
char v4;
if ( serial.extract(v1, v2, v3, v4) ) {}
if ( serial.getNth(0, v2) ) {}
class Fuu {
public:
if ( !s.Extract(v1, v2, v3) ) {}
}
operator cxx::Serialization() const {
return cxx::Serialization::Create(v1, v2, v3);
}
private:
int v1 = 123;
char v2 = 'c';
std::string v3 = "hello world";
};
Simple serializer which serials every given type into the following format: (The type needs to be con...
Definition: serialization.hpp:66
static Serialization create(const Targs &... args) noexcept
Create Serialization if every arguments is convertable to string via cxx::convert::toString,...