CppSerialization  1.0.4.0
C++ Serialization Library
Public Member Functions | List of all members
CppSerialization::JSON::Serializer< OutputStream > Class Template Reference

JSON serializer. More...

#include <serializer.h>

Inheritance diagram for CppSerialization::JSON::Serializer< OutputStream >:

Public Member Functions

 Serializer ()=default
 
 Serializer (OutputStream &stream)
 
 Serializer (const Serializer &)=delete
 
 Serializer (Serializer &&)=default
 
 ~Serializer ()=default
 
Serializeroperator= (const Serializer &)=delete
 
Serializeroperator= (Serializer &&)=default
 
void StartObject ()
 Start new object. More...
 
void EndObject ()
 End the current object. More...
 
void StartArray ()
 Start new array. More...
 
void EndArray ()
 End the current array. More...
 
void Key (const char *key)
 Put the C-string key. More...
 
void Key (const char *key, size_t size)
 Put the C-string key with a given size. More...
 
void Key (const std::string &key)
 Put the string key. More...
 
template<std::size_t N>
void Key (const char(&key)[N])
 Put the fixed string array key. More...
 
void Value (std::nullptr_t value)
 Put the null value. More...
 
void Value (bool value)
 Put the boolean value. More...
 
void Value (int value)
 Put the integer value. More...
 
void Value (unsigned value)
 Put the unsigned integer value. More...
 
void Value (int64_t value)
 Put the 64-bit integer value. More...
 
void Value (uint64_t value)
 Put the 64-bit unsigned integer value. More...
 
void Value (double value)
 Put the double value. More...
 
void Value (const char *value)
 Put the C-string value. More...
 
void Value (const char *value, size_t size)
 Put the C-string value with a given size. More...
 
void Value (const std::string &value)
 Put the string value. More...
 
template<std::size_t N>
void Value (const char(&value)[N])
 Put the fixed string array value. More...
 
void Pair (const char *key, std::nullptr_t value)
 Put the null key/value pair. More...
 
void Pair (const char *key, bool value)
 Put the boolean key/value pair. More...
 
void Pair (const char *key, int value)
 Put the integer key/value pair. More...
 
void Pair (const char *key, unsigned value)
 Put the unsigned integer key/value pair. More...
 
void Pair (const char *key, int64_t value)
 Put the 64-bit integer key/value pair. More...
 
void Pair (const char *key, uint64_t value)
 Put the 64-bit unsigned integer key/value pair. More...
 
void Pair (const char *key, double value)
 Put the double key/value pair. More...
 
void Pair (const char *key, const char *value)
 Put the C-string key/value pair. More...
 
void Pair (const char *key, const char *value, size_t size)
 Put the C-string key/value pair with a given size. More...
 
void Pair (const char *key, const std::string &value)
 Put the string key/value pair. More...
 
template<std::size_t N>
void Pair (const char *key, const char(&value)[N])
 Put the fixed string array key/value pair. More...
 

Detailed Description

template<class OutputStream>
class CppSerialization::JSON::Serializer< OutputStream >

JSON serializer.

JSON serializer is parametrized with an output stream and is used to serialize objects into JSON format.

Definition at line 23 of file serializer.h.

Constructor & Destructor Documentation

◆ Serializer() [1/4]

template<class OutputStream >
CppSerialization::JSON::Serializer< OutputStream >::Serializer ( )
default

◆ Serializer() [2/4]

template<class OutputStream >
CppSerialization::JSON::Serializer< OutputStream >::Serializer ( OutputStream &  stream)
inlineexplicit

Definition at line 27 of file serializer.h.

◆ Serializer() [3/4]

template<class OutputStream >
CppSerialization::JSON::Serializer< OutputStream >::Serializer ( const Serializer< OutputStream > &  )
delete

◆ Serializer() [4/4]

template<class OutputStream >
CppSerialization::JSON::Serializer< OutputStream >::Serializer ( Serializer< OutputStream > &&  )
default

◆ ~Serializer()

template<class OutputStream >
CppSerialization::JSON::Serializer< OutputStream >::~Serializer ( )
default

Member Function Documentation

◆ EndArray()

template<class OutputStream >
void CppSerialization::JSON::Serializer< OutputStream >::EndArray
inline

End the current array.

Definition at line 34 of file serializer.inl.

◆ EndObject()

template<class OutputStream >
void CppSerialization::JSON::Serializer< OutputStream >::EndObject
inline

End the current object.

Definition at line 20 of file serializer.inl.

◆ Key() [1/4]

template<class OutputStream >
void CppSerialization::JSON::Serializer< OutputStream >::Key ( const char *  key)
inline

Put the C-string key.

Definition at line 41 of file serializer.inl.

◆ Key() [2/4]

template<class OutputStream >
void CppSerialization::JSON::Serializer< OutputStream >::Key ( const char *  key,
size_t  size 
)
inline

Put the C-string key with a given size.

Definition at line 48 of file serializer.inl.

◆ Key() [3/4]

template<class OutputStream >
template<std::size_t N>
void CppSerialization::JSON::Serializer< OutputStream >::Key ( const char(&)  key[N])
inline

Put the fixed string array key.

Definition at line 63 of file serializer.inl.

◆ Key() [4/4]

template<class OutputStream >
void CppSerialization::JSON::Serializer< OutputStream >::Key ( const std::string &  key)
inline

Put the string key.

Definition at line 55 of file serializer.inl.

◆ operator=() [1/2]

template<class OutputStream >
Serializer& CppSerialization::JSON::Serializer< OutputStream >::operator= ( const Serializer< OutputStream > &  )
delete

◆ operator=() [2/2]

template<class OutputStream >
Serializer& CppSerialization::JSON::Serializer< OutputStream >::operator= ( Serializer< OutputStream > &&  )
default

◆ Pair() [1/11]

template<class OutputStream >
void CppSerialization::JSON::Serializer< OutputStream >::Pair ( const char *  key,
bool  value 
)
inline

Put the boolean key/value pair.

Definition at line 83 of file serializer.h.

◆ Pair() [2/11]

template<class OutputStream >
void CppSerialization::JSON::Serializer< OutputStream >::Pair ( const char *  key,
const char *  value 
)
inline

Put the C-string key/value pair.

Definition at line 101 of file serializer.h.

◆ Pair() [3/11]

template<class OutputStream >
void CppSerialization::JSON::Serializer< OutputStream >::Pair ( const char *  key,
const char *  value,
size_t  size 
)
inline

Put the C-string key/value pair with a given size.

Definition at line 104 of file serializer.h.

◆ Pair() [4/11]

template<class OutputStream >
template<std::size_t N>
void CppSerialization::JSON::Serializer< OutputStream >::Pair ( const char *  key,
const char(&)  value[N] 
)
inline

Put the fixed string array key/value pair.

Definition at line 111 of file serializer.h.

◆ Pair() [5/11]

template<class OutputStream >
void CppSerialization::JSON::Serializer< OutputStream >::Pair ( const char *  key,
const std::string &  value 
)
inline

Put the string key/value pair.

Definition at line 107 of file serializer.h.

◆ Pair() [6/11]

template<class OutputStream >
void CppSerialization::JSON::Serializer< OutputStream >::Pair ( const char *  key,
double  value 
)
inline

Put the double key/value pair.

Definition at line 98 of file serializer.h.

◆ Pair() [7/11]

template<class OutputStream >
void CppSerialization::JSON::Serializer< OutputStream >::Pair ( const char *  key,
int  value 
)
inline

Put the integer key/value pair.

Definition at line 86 of file serializer.h.

◆ Pair() [8/11]

template<class OutputStream >
void CppSerialization::JSON::Serializer< OutputStream >::Pair ( const char *  key,
int64_t  value 
)
inline

Put the 64-bit integer key/value pair.

Definition at line 92 of file serializer.h.

◆ Pair() [9/11]

template<class OutputStream >
void CppSerialization::JSON::Serializer< OutputStream >::Pair ( const char *  key,
std::nullptr_t  value 
)
inline

Put the null key/value pair.

Definition at line 80 of file serializer.h.

◆ Pair() [10/11]

template<class OutputStream >
void CppSerialization::JSON::Serializer< OutputStream >::Pair ( const char *  key,
uint64_t  value 
)
inline

Put the 64-bit unsigned integer key/value pair.

Definition at line 95 of file serializer.h.

◆ Pair() [11/11]

template<class OutputStream >
void CppSerialization::JSON::Serializer< OutputStream >::Pair ( const char *  key,
unsigned  value 
)
inline

Put the unsigned integer key/value pair.

Definition at line 89 of file serializer.h.

◆ StartArray()

template<class OutputStream >
void CppSerialization::JSON::Serializer< OutputStream >::StartArray
inline

Start new array.

Definition at line 27 of file serializer.inl.

◆ StartObject()

template<class OutputStream >
void CppSerialization::JSON::Serializer< OutputStream >::StartObject
inline

Start new object.

Definition at line 13 of file serializer.inl.

◆ Value() [1/11]

template<class OutputStream >
void CppSerialization::JSON::Serializer< OutputStream >::Value ( bool  value)
inline

Put the boolean value.

Definition at line 77 of file serializer.inl.

◆ Value() [2/11]

template<class OutputStream >
void CppSerialization::JSON::Serializer< OutputStream >::Value ( const char *  value)
inline

Put the C-string value.

Definition at line 119 of file serializer.inl.

◆ Value() [3/11]

template<class OutputStream >
void CppSerialization::JSON::Serializer< OutputStream >::Value ( const char *  value,
size_t  size 
)
inline

Put the C-string value with a given size.

Definition at line 126 of file serializer.inl.

◆ Value() [4/11]

template<class OutputStream >
template<std::size_t N>
void CppSerialization::JSON::Serializer< OutputStream >::Value ( const char(&)  value[N])
inline

Put the fixed string array value.

Definition at line 141 of file serializer.inl.

◆ Value() [5/11]

template<class OutputStream >
void CppSerialization::JSON::Serializer< OutputStream >::Value ( const std::string &  value)
inline

Put the string value.

Definition at line 133 of file serializer.inl.

◆ Value() [6/11]

template<class OutputStream >
void CppSerialization::JSON::Serializer< OutputStream >::Value ( double  value)
inline

Put the double value.

Definition at line 112 of file serializer.inl.

◆ Value() [7/11]

template<class OutputStream >
void CppSerialization::JSON::Serializer< OutputStream >::Value ( int  value)
inline

Put the integer value.

Definition at line 84 of file serializer.inl.

◆ Value() [8/11]

template<class OutputStream >
void CppSerialization::JSON::Serializer< OutputStream >::Value ( int64_t  value)
inline

Put the 64-bit integer value.

Definition at line 98 of file serializer.inl.

◆ Value() [9/11]

template<class OutputStream >
void CppSerialization::JSON::Serializer< OutputStream >::Value ( std::nullptr_t  value)
inline

Put the null value.

Definition at line 70 of file serializer.inl.

◆ Value() [10/11]

template<class OutputStream >
void CppSerialization::JSON::Serializer< OutputStream >::Value ( uint64_t  value)
inline

Put the 64-bit unsigned integer value.

Definition at line 105 of file serializer.inl.

◆ Value() [11/11]

template<class OutputStream >
void CppSerialization::JSON::Serializer< OutputStream >::Value ( unsigned  value)
inline

Put the unsigned integer value.

Definition at line 91 of file serializer.inl.


The documentation for this class was generated from the following files: