34 #ifndef _Wolframe_SERIALIZE_STRUCT_INTRUSIVE_PARSER_HPP_INCLUDED
35 #define _Wolframe_SERIALIZE_STRUCT_INTRUSIVE_PARSER_HPP_INCLUDED
47 #include <boost/utility/value_init.hpp>
48 #include <boost/cstdint.hpp>
54 template <
typename TYPE>
85 template <
typename TYPE>
struct Parser {};
87 template <>
struct Parser<boost::int64_t>
89 template <>
struct Parser<boost::uint64_t>
90 {
static bool parseValue(
void* value,
const types::VariantConst& element) {
return parseValue_uint64( (boost::uint64_t*)value, element);}};
92 template <>
struct Parser<boost::int32_t>
93 {
static bool parseValue(
void* value,
const types::VariantConst& element) {
return parseValue_int32( (boost::int32_t*)value, element);}};
94 template <>
struct Parser<boost::uint32_t>
95 {
static bool parseValue(
void* value,
const types::VariantConst& element) {
return parseValue_uint32( (boost::uint32_t*)value, element);}};
97 template <>
struct Parser<boost::int16_t>
98 {
static bool parseValue(
void* value,
const types::VariantConst& element) {
return parseValue_short( (boost::int16_t*)value, element);}};
99 template <>
struct Parser<boost::uint16_t>
100 {
static bool parseValue(
void* value,
const types::VariantConst& element) {
return parseValue_ushort( (boost::uint16_t*)value, element);}};
102 template <>
struct Parser<signed char>
103 {
static bool parseValue(
void* value,
const types::VariantConst& element) {
return parseValue_char( (
signed char*)value, element);}};
104 template <>
struct Parser<unsigned char>
105 {
static bool parseValue(
void* value,
const types::VariantConst& element) {
return parseValue_uchar( (
unsigned char*)value, element);}};
107 template <>
struct Parser<float>
108 {
static bool parseValue(
void* value,
const types::VariantConst& element) {
return parseValue_float( (
float*)value, element);}};
110 template <>
struct Parser<bool>
111 {
static bool parseValue(
void* value,
const types::VariantConst& element) {
return parseValue_bool( (
bool*)value, element);}};
113 template <>
struct Parser<double>
116 template <>
struct Parser<std::string>
117 {
static bool parseValue(
void* value,
const types::VariantConst& element) {
return parseValue_string( (std::string*)value, element);}};
119 template <>
struct Parser<types::DateTime>
122 template <>
struct Parser<types::BigNumber>
125 template <
typename TYPE>
126 bool parseObject_(
const traits::struct_&, langbind::TypedInputFilter& inp, Context& ctx, ParseStateStack& stk)
131 template <
typename TYPE>
132 bool parseObject_(
const traits::vector_&, langbind::TypedInputFilter&, Context&, ParseStateStack& stk)
134 if (stk.back().state())
139 typedef typename TYPE::value_type Element;
140 boost::value_initialized<Element> val;
141 ((TYPE*)stk.back().value())->push_back( val);
142 stk.back().state( 1);
143 Element* ee = &((TYPE*)stk.back().value())->back();
148 stk.push_back( ParseState( 0, &IntrusiveParser<Element>::parse, ee));
152 template <
typename TYPE>
153 static bool parseObject_(
const traits::atomic_&, langbind::TypedInputFilter& inp, Context& ctx, ParseStateStack& stk)
161 template <
typename TYPE>
State stack for an initializer of a structure.
Definition: parseStack.hpp:80
bool parseValue_uint64(boost::uint64_t *value, const types::VariantConst &element)
bool parseObjectAtomic(ParseValue parseVal, langbind::TypedInputFilter &inp, Context &, ParseStateStack &stk)
Atomic element type.
Definition: structDescriptionBase.hpp:58
Type for representing arbitrary precision fixed point numbers and big integers as binary coded decima...
bool parseValue_bool(bool *, const types::VariantConst &element)
bool parseValue_int32(boost::int32_t *value, const types::VariantConst &element)
defines the type traits for the intrusive part of serialization/deserialization
Base class for structure description used for introspection in serialization/deserialization.
Definition: structDescriptionBase.hpp:51
Custom data type interface for variant.
bool parseAtomicElementEndTag(langbind::TypedInputFilter &inp, Context &, ParseStateStack &stk)
Type for representing big numbers as binary coded decimal (BCD) numbers.
Definition: bignumber.hpp:49
forward declaration
Definition: intrusiveParser.hpp:55
bool parseValue_ushort(unsigned short *, const types::VariantConst &element)
bool(* ParseValue)(void *value, const types::VariantConst &element)
Definition: intrusiveParser.hpp:64
Data type for normalized date time (absolute time without time zone info)
Definition: datetime.hpp:55
bool parseValue_float(float *, const types::VariantConst &element)
bool parseValue_string(std::string *, const types::VariantConst &element)
bool parseValue_uchar(unsigned char *, const types::VariantConst &element)
Variant value type that represents a variant copy without content ownership.
Definition: variant.hpp:286
bool parseValue_datetime(types::DateTime *, const types::VariantConst &element)
bool parseValue_double(double *, const types::VariantConst &element)
bool parseValue_char(signed char *, const types::VariantConst &element)
Defines the parsing stack for deserialization.
Defines the intrusive implementation of some parsing element properties.
Date and datetime value type.
static bool parse(langbind::TypedInputFilter &inp, Context &ctx, ParseStateStack &stk)
Definition: intrusiveParser.hpp:162
bool parseValue_uint32(boost::uint32_t *value, const types::VariantConst &element)
bool parseObjectStruct(const StructDescriptionBase *descr, langbind::TypedInputFilter &inp, Context &ctx, ParseStateStack &stk)
bool parseValue_int64(boost::int64_t *value, const types::VariantConst &element)
Defines the non intrusive base class of serialization/deserialization of objects interfaced as TypedI...
bool parseValue_short(signed short *, const types::VariantConst &element)
bool parseValue_bignumber(types::BigNumber *, const types::VariantConst &element)
Typed interface for input/output filter.
Global state variables of a running serialization/deserialization procedure (without the stack) ...
Definition: mapContext.hpp:46
bool parseValue(ValueType &val, const types::VariantConst &element)
Definition: parseValue.hpp:405
boost::enable_if_c< boost::is_same< std::vector< typename T::value_type >,T >::value &&!boost::is_same< std::string, T >::value,const vector_ & >::type getCategory(const T &)
get category vector_ for a type
Definition: traits_getCategory.hpp:90