Interface for serializable objects.
More...
#include <serialization.h>
|
| | IRObject () |
| |
| | ~IRObject () |
| |
| | IRObject (const IRObject &other) |
| |
| | IRObject (IRObject &&other) |
| |
| IRObject & | operator= (const IRObject &other) |
| |
| IRObject & | operator= (IRObject &&other) |
| |
| template<typename T > |
| std::enable_if< std::is_integral< T >::value, T >::type | GetScalar () |
| |
| template<typename T > |
| std::enable_if< std::is_floating_point< T >::value, T >::type | GetScalar () |
| |
| template<typename T > |
| std::enable_if< std::is_enum< T >::value, T >::type | GetScalar () |
| |
| template<typename T > |
| std::enable_if< std::is_same< T, std::string >::value, T >::type | GetScalar () |
| |
| template<typename T > |
| std::enable_if< std::is_integral< T >::value, void >::type | SetScalar (T val) |
| |
| template<typename T > |
| std::enable_if< std::is_floating_point< T >::value, void >::type | SetScalar (T val) |
| |
| template<typename T > |
| std::enable_if< std::is_enum< T >::value, void >::type | SetScalar (T val) |
| |
| template<typename T > |
| std::enable_if< std::is_same< T, std::string >::value, void >::type | SetScalar (T val) |
| |
| void | SetScalar (const IRObject &obj) |
| |
| Childrens | GetChildren () |
| |
| void | SetChildren (IRObject *children) |
| |
|
| template<typename T > |
| static std::enable_if< std::is_integral< T >::value||std::is_floating_point< T >::value||std::is_same< T, std::string >::value||std::is_enum< T >::value, IRObject >::type | FromCorpus (T val) |
| |
| template<typename T > |
| static std::enable_if< detail::is_container< T >::value &&!std::is_same< T, std::string >::value, IRObject >::type | FromCorpus (const T &val) |
| |
| template<class TupType , unsigned... I> |
| static void | handle_tuple (const TupType &_tup, IRObject *children, detail::seq< I... >) |
| |
| template<typename... Args> |
| static IRObject | FromCorpus (const std::tuple< Args... > &val) |
| |
| template<typename T1 , typename T2 > |
| static IRObject | FromCorpus (const std::pair< T1, T2 > &val) |
| |
| template<typename T > |
| static std::enable_if< std::is_integral< T >::value||std::is_enum< T >::value, T >::type | ToCorpus (IRObject obj) |
| |
| template<typename T > |
| static std::enable_if< std::is_floating_point< T >::value, T >::type | ToCorpus (IRObject obj) |
| |
| template<typename T > |
| static std::enable_if< std::is_same< T, std::string >::value, T >::type | ToCorpus (IRObject obj) |
| |
| template<typename TupType , unsigned... I> |
| static TupType | parse_tuple (IRObject *children, detail::seq< I... >) |
| |
| template<typename T > |
| static std::enable_if< detail::is_container< T >::value &&!std::is_same< T, std::string >::value, T >::type | ToCorpus (IRObject obj) |
| |
| template<typename T > |
| static std::enable_if< detail::is_specialization< T, std::tuple >::value, T >::type | ToCorpus (IRObject obj) |
| |
| template<typename T > |
| static std::enable_if< detail::is_specialization< T, std::pair >::value, T >::type | ToCorpus (IRObject obj) |
| |
| static char * | alloc_str (size_t size) |
| |
| static IRObject * | alloc (size_t size) |
| |
| static std::string | ToString (IRObject obj) |
| |
| static IRObject | FromString (std::string str) |
| |
| static std::vector< uint8_t > | ToBinary (IRObject obj) |
| |
| static IRObject | FromBinary (std::vector< uint8_t > bin) |
| |
Interface for serializable objects.
IRObject (Intermediate Representation Object) provides a low-level interface for serializing data types into a common format. It uses a union to store different data types and provides type-safe access through templated getter methods.
The object can store:
- Integers (int64_t)
- Floating point numbers (double)
- Strings (char* for long strings, char[8] for short strings)
- Nested objects (IRObject*)
Memory management:
- The object takes ownership of allocated strings and nested objects
- Copy/move operations perform deep copies/moves
- The destructor frees any owned memory
Usage example:
Interface for serializable objects.
Definition serialization.h:43
int64_t i
Definition serialization.h:61
std::enable_if< std::is_integral< T >::value, T >::type GetScalar()
Definition serialization.h:71
@ Int
Definition serialization.h:58
unsigned type
Definition serialization.h:68
◆ Type
| Enumerator |
|---|
| Undefined | |
| Int | |
| Float | |
| String | |
| ShortString | |
| Object | |
◆ IRObject() [1/3]
| zeroerr::IRObject::IRObject |
( |
| ) |
|
|
inline |
◆ ~IRObject()
| zeroerr::IRObject::~IRObject |
( |
| ) |
|
|
inline |
◆ IRObject() [2/3]
| zeroerr::IRObject::IRObject |
( |
const IRObject & |
other | ) |
|
|
inline |
◆ IRObject() [3/3]
| zeroerr::IRObject::IRObject |
( |
IRObject && |
other | ) |
|
|
inline |
◆ alloc()
| IRObject * zeroerr::IRObject::alloc |
( |
size_t |
size | ) |
|
|
static |
◆ alloc_str()
| char * zeroerr::IRObject::alloc_str |
( |
size_t |
size | ) |
|
|
static |
◆ FromBinary()
| IRObject zeroerr::IRObject::FromBinary |
( |
std::vector< uint8_t > |
bin | ) |
|
|
static |
◆ FromCorpus() [1/4]
template<typename T1 , typename T2 >
| static IRObject zeroerr::IRObject::FromCorpus |
( |
const std::pair< T1, T2 > & |
val | ) |
|
|
inlinestatic |
◆ FromCorpus() [2/4]
template<typename... Args>
| static IRObject zeroerr::IRObject::FromCorpus |
( |
const std::tuple< Args... > & |
val | ) |
|
|
inlinestatic |
◆ FromCorpus() [3/4]
◆ FromCorpus() [4/4]
template<typename T >
| static std::enable_if< std::is_integral< T >::value||std::is_floating_point< T >::value||std::is_same< T, std::string >::value||std::is_enum< T >::value, IRObject >::type zeroerr::IRObject::FromCorpus |
( |
T |
val | ) |
|
|
inlinestatic |
◆ FromString()
| IRObject zeroerr::IRObject::FromString |
( |
std::string |
str | ) |
|
|
static |
◆ GetChildren()
◆ GetScalar() [1/4]
template<typename T >
| std::enable_if< std::is_integral< T >::value, T >::type zeroerr::IRObject::GetScalar |
( |
| ) |
|
|
inline |
◆ GetScalar() [2/4]
template<typename T >
| std::enable_if< std::is_floating_point< T >::value, T >::type zeroerr::IRObject::GetScalar |
( |
| ) |
|
|
inline |
◆ GetScalar() [3/4]
template<typename T >
| std::enable_if< std::is_enum< T >::value, T >::type zeroerr::IRObject::GetScalar |
( |
| ) |
|
|
inline |
◆ GetScalar() [4/4]
template<typename T >
| std::enable_if< std::is_same< T, std::string >::value, T >::type zeroerr::IRObject::GetScalar |
( |
| ) |
|
|
inline |
◆ handle_tuple()
template<class TupType , unsigned... I>
| static void zeroerr::IRObject::handle_tuple |
( |
const TupType & |
_tup, |
|
|
IRObject * |
children, |
|
|
detail::seq< I... > |
|
|
) |
| |
|
inlinestatic |
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ parse_tuple()
template<typename TupType , unsigned... I>
◆ SetChildren()
| void zeroerr::IRObject::SetChildren |
( |
IRObject * |
children | ) |
|
|
inline |
◆ SetScalar() [1/5]
| void zeroerr::IRObject::SetScalar |
( |
const IRObject & |
obj | ) |
|
|
inline |
◆ SetScalar() [2/5]
template<typename T >
| std::enable_if< std::is_integral< T >::value, void >::type zeroerr::IRObject::SetScalar |
( |
T |
val | ) |
|
|
inline |
◆ SetScalar() [3/5]
template<typename T >
| std::enable_if< std::is_floating_point< T >::value, void >::type zeroerr::IRObject::SetScalar |
( |
T |
val | ) |
|
|
inline |
◆ SetScalar() [4/5]
template<typename T >
| std::enable_if< std::is_enum< T >::value, void >::type zeroerr::IRObject::SetScalar |
( |
T |
val | ) |
|
|
inline |
◆ SetScalar() [5/5]
template<typename T >
| std::enable_if< std::is_same< T, std::string >::value, void >::type zeroerr::IRObject::SetScalar |
( |
T |
val | ) |
|
|
inline |
◆ ToBinary()
| std::vector< uint8_t > zeroerr::IRObject::ToBinary |
( |
IRObject |
obj | ) |
|
|
static |
◆ ToCorpus() [1/6]
template<typename T >
| static std::enable_if< std::is_integral< T >::value||std::is_enum< T >::value, T >::type zeroerr::IRObject::ToCorpus |
( |
IRObject |
obj | ) |
|
|
inlinestatic |
◆ ToCorpus() [2/6]
template<typename T >
| static std::enable_if< std::is_floating_point< T >::value, T >::type zeroerr::IRObject::ToCorpus |
( |
IRObject |
obj | ) |
|
|
inlinestatic |
◆ ToCorpus() [3/6]
template<typename T >
| static std::enable_if< std::is_same< T, std::string >::value, T >::type zeroerr::IRObject::ToCorpus |
( |
IRObject |
obj | ) |
|
|
inlinestatic |
◆ ToCorpus() [4/6]
◆ ToCorpus() [5/6]
◆ ToCorpus() [6/6]
◆ ToString()
| std::string zeroerr::IRObject::ToString |
( |
IRObject |
obj | ) |
|
|
static |
◆ [union]
| double zeroerr::IRObject::f |
| int64_t zeroerr::IRObject::i |
◆ others
| char zeroerr::IRObject::others[7] |
| char* zeroerr::IRObject::s |
◆ ss
| char zeroerr::IRObject::ss[8] |
◆ type
| unsigned zeroerr::IRObject::type |
The documentation for this struct was generated from the following files: