32#ifndef _QORE_CLASS_INTERN_QORESERIALIZABLE_H
34#define _QORE_CLASS_INTERN_QORESERIALIZABLE_H
37#include "qore/intern/StreamReader.h"
38#include "qore/intern/StreamWriter.h"
45typedef std::map<std::string, QoreValue> oimap_t;
48typedef std::map<std::string, std::string> imap_t;
51typedef std::set<std::string> mset_t;
55enum qore_stream_type :
unsigned char {
77class QoreInternalSerializationContext {
85 typedef std::set<const QoreClass*> cset_t;
90 DLLLOCAL QoreInternalSerializationContext(
ExceptionSink* xsink,
int64 flags) : flags(flags), index(xsink),
102 DLLLOCAL
void addModule(
const char* module) {
110 index->setKeyValue(str, v, xsink);
117 svars->setKeyValue(str, v, xsink);
123class ObjectIndexMap :
public oimap_t {
128 DLLLOCAL ~ObjectIndexMap();
134class QoreInternalDeserializationContext {
136 ObjectIndexMap oimap;
139 DLLLOCAL QoreInternalDeserializationContext(
ExceptionSink* xsink,
int64 flags) : oimap(xsink), flags(flags) {
148friend class QoreInternalSerializationContext;
149friend class QoreInternalDeserializationContext;
173 DLLLOCAL
virtual ~QoreSerializable() {}
176 QoreInternalSerializationContext& context,
ExceptionSink* xsink);
178 DLLLOCAL
static imap_t::iterator serializeObjectToIndex(
const QoreObject& obj,
179 QoreInternalSerializationContext& context,
ExceptionSink* xsink);
181 DLLLOCAL
static imap_t::iterator serializeObjectToIndexIntern(
const QoreObject& self,
182 QoreInternalSerializationContext& context,
const QoreString& str,
185 DLLLOCAL
static QoreValue serializeValue(
const QoreValue val, QoreInternalSerializationContext& context,
189 QoreInternalSerializationContext& context,
ExceptionSink* xsink);
191 DLLLOCAL
static imap_t::iterator serializeHashToIndex(
const QoreHashNode& h,
192 QoreInternalSerializationContext& context,
ExceptionSink* xsink);
194 DLLLOCAL
static imap_t::iterator serializeHashToIndexIntern(
const QoreHashNode& h,
195 QoreInternalSerializationContext& context,
const QoreString& str,
199 QoreInternalSerializationContext& context,
ExceptionSink* xsink);
201 DLLLOCAL
static imap_t::iterator serializeListToIndex(
const QoreListNode& l,
202 QoreInternalSerializationContext& context,
ExceptionSink* xsink);
204 DLLLOCAL
static imap_t::iterator serializeListToIndexIntern(
const QoreListNode& h,
205 QoreInternalSerializationContext& context,
const QoreString& str,
211 bool can_be_negative =
false);
216 DLLLOCAL
static int serializeStringToStream(
StreamWriter& writer,
const char* key,
size_t len,
228 DLLLOCAL
static QoreValue deserializeData(
const QoreValue val, QoreInternalDeserializationContext& context,
232 QoreInternalDeserializationContext& context);
240 DLLLOCAL
static QoreValue deserializeListData(
const QoreListNode& l, QoreInternalDeserializationContext& context,
243 DLLLOCAL
static QoreValue deserializeIndexedContainer(
const char* key,
244 QoreInternalDeserializationContext& context,
ExceptionSink* xsink);
245 DLLLOCAL
static QoreValue deserializeIndexedWeakReference(
const char* key,
246 QoreInternalDeserializationContext& context,
ExceptionSink* xsink);
249 qore_stream_type code,
int64 flags);
the base class for all data to be used as private data of Qore objects
Definition AbstractPrivateData.h:44
holds arbitrary binary data
Definition BinaryNode.h:41
Qore's parse tree/value type for date-time values, reference-counted, dynamically-allocated only.
Definition DateTimeNode.h:47
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition ExceptionSink.h:50
Interface for private data of output streams.
Definition OutputStream.h:44
defines a Qore-language class
Definition QoreClass.h:310
defines string encoding functions in Qore
Definition QoreEncoding.h:83
This is the hash or associative list container type in Qore, dynamically allocated only,...
Definition QoreHashNode.h:51
This is the list container type in Qore, dynamically allocated only, reference counted.
Definition QoreListNode.h:52
Qore's arbitrary-precision number value type, dynamically-allocated only, reference counted.
Definition QoreNumberNode.h:51
the implementation of Qore's object data type, reference counted, dynamically-allocated only
Definition QoreObject.h:61
Qore's string type supported by the QoreEncoding class.
Definition QoreString.h:93
Qore's string value type, reference counted, dynamically-allocated only.
Definition QoreStringNode.h:50
a templated class to manage a reference count of an object that can throw a Qore-language exception w...
Definition ReferenceHolder.h:52
Private data for the Qore::StreamReader class.
Definition StreamReader.h:45
Private data for the Qore::StreamWriter class.
Definition StreamWriter.h:43
long long int64
64bit integer type, cannot use int64_t here since it breaks the API on some 64-bit systems due to equ...
Definition common.h:266
The main value class in Qore, designed to be passed by value.
Definition QoreValue.h:279