Eile Mit Weile
Loading...
Searching...
No Matches
value_type_helpers Namespace Reference

Helper functions for serializing and deserializing instances of SerializableValue. More...

Enumerations

enum  ValueType {
  intType , uintType , boolType , floatType ,
  doubleType , stringType , int64tType , uint64tType
}
 Enum for the supported value types.
 

Functions

template<>
rapidjson::Value get_json_value< bool > (bool val, rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > &allocator)
 specialization of get_json_value for bool.
 
template<>
rapidjson::Value get_json_value< int > (int val, rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > &allocator)
 specialization of get_json_value for int.
 
template<>
rapidjson::Value get_json_value< float > (float val, rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > &allocator)
 specialization of get_json_value for float.
 
template<>
rapidjson::Value get_json_value< double > (double val, rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > &allocator)
 specialization of get_json_value for double.
 
template<>
rapidjson::Value get_json_value< unsigned int > (unsigned int val, rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > &allocator)
 specialization of get_json_value for unsigned int.
 
template<>
rapidjson::Value get_json_value< int64_t > (int64_t val, rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > &allocator)
 specialization of get_json_value for int64_t.
 
template<>
rapidjson::Value get_json_value< uint64_t > (uint64_t val, rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > &allocator)
 specialization of get_json_value for uint64_t.
 
template<>
rapidjson::Value get_json_value< std::string > (std::string val, rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > &allocator)
 specialization of get_json_value for string.
 
template<>
rapidjson::Value get_json_value_type< bool > (bool val, rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > &allocator)
 specialization of get_json_value_type for bool.
 
template<>
rapidjson::Value get_json_value_type< int > (int val, rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > &allocator)
 specialization of get_json_value_type for int.
 
template<>
rapidjson::Value get_json_value_type< float > (float val, rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > &allocator)
 specialization of get_json_value_type for float.
 
template<>
rapidjson::Value get_json_value_type< double > (double val, rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > &allocator)
 specialization of get_json_value_type for double.
 
template<>
rapidjson::Value get_json_value_type< unsigned int > (unsigned int val, rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > &allocator)
 specialization of get_json_value_type for unsigned int.
 
template<>
rapidjson::Value get_json_value_type< int64_t > (int64_t val, rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > &allocator)
 specialization of get_json_value_type for int64_t.
 
template<>
rapidjson::Value get_json_value_type< uint64_t > (uint64_t val, rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > &allocator)
 specialization of get_json_value_type for uint64_t.
 
template<>
rapidjson::Value get_json_value_type< std::string > (std::string val, rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > &allocator)
 specialization of get_json_value_type for string.
 

Variables

const std::unordered_map< std::string, ValueType_string_to_value_type
 Converts a string to a value type.
 
const std::unordered_map< ValueType, std::string > _value_type_to_string
 Converts a value type to a string.
 

Detailed Description

Helper functions for serializing and deserializing instances of SerializableValue.

Variable Documentation

◆ _string_to_value_type

const std::unordered_map<std::string, ValueType> value_type_helpers::_string_to_value_type
Initial value:
= {
{"int", ValueType::intType },
{"uint", ValueType::uintType},
{"bool", ValueType::boolType},
{"float", ValueType::floatType},
{"double", ValueType::doubleType},
{"int64t", ValueType::int64tType},
{"uint64t", ValueType::uint64tType},
{"string", ValueType::stringType}
}

Converts a string to a value type.

Parameters
strThe string to convert.
Returns
The value type.

◆ _value_type_to_string

const std::unordered_map<ValueType, std::string> value_type_helpers::_value_type_to_string
Initial value:
= {
{ ValueType::intType, "int" },
{ ValueType::uintType, "uint"},
{ ValueType::boolType, "bool"},
{ ValueType::floatType, "float"},
{ ValueType::doubleType, "double"},
{ ValueType::int64tType, "int64t"},
{ ValueType::uint64tType, "uint64t"},
{ ValueType::stringType, "string"},
}

Converts a value type to a string.

Parameters
valThe value type to convert.
Returns
The string.