|
| template<typename T > |
| static std::enable_if< std::is_integral< T >::value||std::is_floating_point< T >::value||detail::StringLike< T >::owning||std::is_enum< T >::value, IRObject >::type | FromCorpus (T val) |
| |
| template<typename T > |
| static std::enable_if< detail::is_container< T >::value &&!detail::StringLike< T >::owning, 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< detail::StringLike< T >::owning, 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 &&!detail::StringLike< T >::owning, 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 zeroerr::String | ToString (IRObject obj) |
| |
| static IRObject | FromString (zeroerr::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:45
unsigned char type
Definition serialization.h:70
int64_t i
Definition serialization.h:63
std::enable_if< std::is_integral< T >::value, T >::type GetScalar()
Definition serialization.h:73
@ Int
Definition serialization.h:60