HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GA_PrimitiveJSONExtend.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: GA_PrimitiveJSONExtend.h ( GA Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __GA_PrimitiveJSONExtend__
12 #define __GA_PrimitiveJSONExtend__
13 
14 #include "GA_API.h"
15 #include "GA_PrimitiveJSON.h"
16 
17 
18 class GA_LoadMap;
19 class GA_Primitive;
20 class GA_SaveMap;
21 
22 class UT_JSONParser;
23 class UT_JSONValue;
24 class UT_JSONWriter;
25 
26 
27 /// Class which extends an existing JSON schema
29 {
30 public:
32  virtual ~GA_PrimitiveJSONExtend();
33 
34  /// @{
35  /// Methods implemented from base GA_PrimitiveJSON. These methods are all
36  /// implemented as: @code
37  /// if (isBase(i))
38  /// myBase->method(i, ...);
39  /// else
40  /// localMethod(getLocal(i), ...);
41  /// @endcode
42  /// Return the number of data fields in the primitive private schema
43  virtual int getEntries() const;
44  virtual const UT_StringHolder &getKeyword(int i) const;
45  virtual bool saveField(const GA_Primitive *prim, int i,
46  UT_JSONWriter &w, const GA_SaveMap &map) const;
47  virtual bool saveField(const GA_Primitive *prim, int i,
49  const GA_SaveMap &map) const;
50  virtual bool loadField(GA_Primitive *prim, int i,
51  UT_JSONParser &p, const GA_LoadMap &map) const;
52  virtual bool loadField(GA_Primitive *prim, int i,
53  UT_JSONParser &p, const UT_JSONValue &value,
54  const GA_LoadMap &map) const;
55  virtual bool isEqual(int i,
56  const GA_Primitive *prim1,
57  const GA_Primitive *prim2) const;
58  /// @}
59 
60  /// @{
61  /// The local methods return information about the local schema (i.e. the
62  /// extending schema. All indices (@c i) are 0 based.
63  virtual int localEntries() const = 0;
64  virtual const UT_StringHolder &localKeyword(int i) const = 0;
65  virtual bool localSave(const GA_Primitive *prim, int i,
66  UT_JSONWriter &w,
67  const GA_SaveMap &map) const = 0;
68  virtual bool localSave(const GA_Primitive *prim, int i,
69  UT_JSONValue &value,
70  const GA_SaveMap &map) const = 0;
71  virtual bool localLoad(GA_Primitive *prim, int i,
72  UT_JSONParser &p,
73  const GA_LoadMap &map) const = 0;
74  virtual bool localLoad(GA_Primitive *prim, int i,
75  UT_JSONParser &p, const UT_JSONValue &value,
76  const GA_LoadMap &map) const = 0;
77  virtual bool localIsEqual(int i,
78  const GA_Primitive *prim1,
79  const GA_Primitive *prim2) const = 0;
80  /// @}
81 
82 protected:
83  bool isBase(int i) const { return i < myBaseEntries; }
84  int getLocal(int i) const { return i - myBaseEntries; }
85 
88 };
89 
90 #endif
const GA_PrimitiveJSON * myBase
Used to pass options and map offset values during saving.
Definition: GA_SaveMap.h:48
JSON reader class which handles parsing of JSON or bJSON files.
Definition: UT_JSONParser.h:75
#define GA_API
Definition: GA_API.h:12
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:32
virtual bool isEqual(int i, const GA_Primitive *prim1, const GA_Primitive *prim2) const =0
png_uint_32 i
Definition: png.h:2877
virtual bool loadField(GA_Primitive *prim, int i, UT_JSONParser &p, const GA_LoadMap &load) const =0
Provide a JSON interface to a primitive.
Options during loading.
Definition: GA_LoadMap.h:42
Class which extends an existing JSON schema.
GLsizei const GLfloat * value
Definition: glcorearb.h:823
virtual bool saveField(const GA_Primitive *prim, int i, UT_JSONWriter &w, const GA_SaveMap &save) const =0
Class to store JSON objects as C++ objects.
Definition: UT_JSONValue.h:75
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:856
virtual int getEntries() const =0
Return the number of data fields in the primitive private schema.
virtual const UT_StringHolder & getKeyword(int i) const =0