NAP
writer.h
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4 
5 #pragma once
6 
7 // Local Includes
8 #include "typeinfo.h"
9 #include "rttiutilities.h"
10 
11 // External Includes
12 #include <utility/dllexport.h>
13 
14 namespace nap
15 {
16  // Forward Declares
17  namespace utility
18  {
19  class ErrorState;
20  }
21 
22  namespace rtti
23  {
24  // Forward Declares
25  class Object;
26 
32  class NAPAPI Writer
33  {
34  public:
35 
41  virtual bool start(const ObjectList& rootObjects) = 0;
42 
46  virtual bool finish() = 0;
47 
51  virtual bool startRootObject(const rtti::TypeInfo& type) = 0;
52 
56  virtual bool finishRootObject() = 0;
57 
61  virtual bool startCompound(const rtti::TypeInfo& type) = 0;
62 
66  virtual bool finishCompound() = 0;
67 
71  virtual bool startArray(int length) = 0;
72 
76  virtual bool finishArray() = 0;
77 
81  virtual bool writeProperty(const std::string& propertyName) = 0;
82 
86  virtual bool writePointer(const std::string& pointeeID) = 0;
87 
91  virtual bool writePrimitive(const rtti::TypeInfo& type, const rtti::Variant& value) = 0;
92 
96  virtual bool supportsEmbeddedPointers() const = 0;
97  };
98 
109  bool NAPAPI serializeObjects(const ObjectList& rootObjects, Writer& writer, utility::ErrorState& errorState);
110 
123  bool NAPAPI serializeObject(rtti::Object& object, Writer& writer, utility::ErrorState& errorState);
124  }
125 }
nap::rtti::Writer
Definition: writer.h:32
nap::rtti::Object
Definition: object.h:30
nap::utility::ErrorState
Definition: errorstate.h:19
nap::rtti::serializeObject
bool NAPAPI serializeObject(rtti::Object &object, Writer &writer, utility::ErrorState &errorState)
nap::rtti::serializeObjects
bool NAPAPI serializeObjects(const ObjectList &rootObjects, Writer &writer, utility::ErrorState &errorState)
nap::rtti::ObjectList
std::vector< Object * > ObjectList
Definition: rttiutilities.h:34
nap
Definition: templateapp.h:17
nap::rtti::Variant
rttr::variant Variant
Definition: typeinfo.h:143
nap::rtti::TypeInfo
rttr::type TypeInfo
Definition: typeinfo.h:140