hivemind 1.0.0
Loading...
Searching...
No Matches
serializer.h File Reference
#include "rapidjson/document.h"
#include <iostream>
#include <map>
#include <memory>
#include <string>
#include <type_traits>
#include <vector>
Include dependency graph for serializer.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Json::ISProperty
 Serializing and deserializing (persistent values) requires recflection which is a way for the programmer to ensure that the data you serialize will get back to the place you want it to be when you deserialize it later. More...
 
class  Json::ISValue
 Rflection is made possible by the help of the ISValue class and the type classes. More...
 
class  Json::ISInt
 Implementation for integers. More...
 
class  Json::ISFloat
 Implementation for floats. More...
 
class  Json::ISDouble
 Implementation for doubles. More...
 
class  Json::ISBool
 Implementation for bools. More...
 
class  Json::ISString
 Implementation for strings. More...
 
class  Json::ISObject< T >
 Implementation for objects. More...
 
class  Json::ISObjectVector< T >
 Implementation for a vector with objects. More...
 
class  Json::ISObjVecVec< T >
 Implementation for a vector with vectors with objects. More...
 
class  Json::ISMemVecVec< T >
 Implementation for a vector with vectors with members. More...
 
class  Json::ISMember< T >
 Implementation for Members. More...
 
class  Json::ISMemberVector< T >
 Implementation for a vector with members. More...
 
class  Json::ISIntVector
 Implementation for a vector with integers. More...
 
class  Json::ISFloatVector
 Implementation for a vector with floats. More...
 
class  Json::ISDoubleVector
 Implementation for a vector with doubles. More...
 
class  Json::ISConstructors
 Implemented for future expansion. More...
 

Namespaces

namespace  Json
 

Macros

#define JSON
 Macros To serialize an object you need to have the GetProperty() function in the object.
 
#define JSONSTART
 
#define JSONINT(m)
 
#define JSONINTVECTOR(m)
 
#define JSONFLOAT(m)
 
#define JSONFLOATVECTOR(m)
 
#define JSONDOUBLE(m)
 
#define JSONDOUBLEVECTOR(m)
 
#define JSONBOOL(m)
 
#define JSONSTRING(m)
 
#define JSONOBJECT(T, m)
 
#define JSONOBJECTVECTOR(T, m)
 
#define JSONOBJVECVEC(T, m)
 
#define JSONMEMBER(T, m)
 
#define JSONMEMBERVECTOR(T, m)
 
#define JSONMEMVECVEC(T, m)
 
#define JSONEND
 

Typedefs

using Json::ISValuePtr = std::shared_ptr< ISValue >
 
using Json::ISValues = std::vector< ISValuePtr >
 
using Json::ISProperties = std::vector< ISProperty >
 ISProperties is a vector with ISProperty.
 
using Json::ISIV = std::vector< int >
 
using Json::ISFV = std::vector< float >
 
using Json::ISDV = std::vector< double >
 

Functions

void Json::serialize (std::string filename, ISValue *p)
 Function to start serializing an onbject.
 
void Json::deserialize (std::string filename, ISValue *p)
 Function to start deserializing a file.
 

Variables

bool debug
 

Macro Definition Documentation

◆ JSON

#define JSON
Value:
public \
Json::ISValue

Macros To serialize an object you need to have the GetProperty() function in the object.

This is complex for each application programmer to execute so therefore these macros have benn implemented. Each macro start with JSONSTART then each of the types you want to serialize and to end the macro you write JSONEND.

Definition at line 525 of file serializer.h.

◆ JSONBOOL

#define JSONBOOL (   m)
Value:
{ \
# m, std::make_shared < Json::ISBool>(m) \
}

Definition at line 557 of file serializer.h.

◆ JSONDOUBLE

#define JSONDOUBLE (   m)
Value:
{ \
# m, std::make_shared < Json::ISDouble>(m) \
}

Definition at line 549 of file serializer.h.

◆ JSONDOUBLEVECTOR

#define JSONDOUBLEVECTOR (   m)
Value:
{ \
# m, std::make_shared < Json::ISDoubleVector>(m) \
}

Definition at line 553 of file serializer.h.

◆ JSONEND

#define JSONEND
Value:
} \
; \
return prop; \
} \
;

Definition at line 590 of file serializer.h.

◆ JSONFLOAT

#define JSONFLOAT (   m)
Value:
{ \
# m, std::make_shared < Json::ISFloat>(m) \
}

Definition at line 541 of file serializer.h.

◆ JSONFLOATVECTOR

#define JSONFLOATVECTOR (   m)
Value:
{ \
# m, std::make_shared < Json::ISFloatVector>(m) \
}

Definition at line 545 of file serializer.h.

◆ JSONINT

#define JSONINT (   m)
Value:
{ \
# m, std::make_shared < Json::ISInt>(m) \
}

Definition at line 533 of file serializer.h.

◆ JSONINTVECTOR

#define JSONINTVECTOR (   m)
Value:
{ \
# m, std::make_shared < Json::ISIntVector>(m) \
}

Definition at line 537 of file serializer.h.

◆ JSONMEMBER

#define JSONMEMBER (   T,
 
)
Value:
{ \
# m, std::make_shared < Json::ISMember < T>>(m) \
}

Definition at line 577 of file serializer.h.

◆ JSONMEMBERVECTOR

#define JSONMEMBERVECTOR (   T,
 
)
Value:
{ \
# m, std::make_shared < Json::ISMemberVector < T>>(m) \
}

Definition at line 581 of file serializer.h.

◆ JSONMEMVECVEC

#define JSONMEMVECVEC (   T,
 
)
Value:
{ \
# m, std::make_shared < Json::ISMemVecVec < T>>(m) \
}

Definition at line 585 of file serializer.h.

◆ JSONOBJECT

#define JSONOBJECT (   T,
 
)
Value:
{ \
# m, std::make_shared < Json::ISObject < T>>(m) \
}

Definition at line 565 of file serializer.h.

◆ JSONOBJECTVECTOR

#define JSONOBJECTVECTOR (   T,
 
)
Value:
{ \
# m, std::make_shared < Json::ISObjectVector < T>>(m) \
}

Definition at line 569 of file serializer.h.

◆ JSONOBJVECVEC

#define JSONOBJVECVEC (   T,
 
)
Value:
{ \
# m, std::make_shared < Json::ISObjVecVec < T>>(m) \
}

Definition at line 573 of file serializer.h.

◆ JSONSTART

#define JSONSTART
Value:
virtual Json::ISProperties GetProperty() \
{ \
std::vector< ISProperty > ISProperties
ISProperties is a vector with ISProperty.
Definition: serializer.h:34

Definition at line 529 of file serializer.h.

◆ JSONSTRING

#define JSONSTRING (   m)
Value:
{ \
# m, std::make_shared < Json::ISString>(m) \
}

Definition at line 561 of file serializer.h.

Variable Documentation

◆ debug

bool debug
extern

Definition at line 12 of file serializer.cpp.

Referenced by Json::ISDouble::ToDom(), and Json::ISMemberVector< T >::ToDom().