HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GA_AIFJSON.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_AIFJSON.h ( GA Library, C++)
7  *
8  * COMMENTS: Attribute Interface for file I/O
9  */
10 
11 #ifndef __GA_AIFJSON__
12 #define __GA_AIFJSON__
13 
14 #include "GA_API.h"
15 
16 #include <SYS/SYS_Types.h>
17 
18 
19 class GA_Attribute;
20 class GA_LoadMap;
21 class GA_Range;
22 class GA_SaveMap;
23 class UT_JSONParser;
24 class UT_JSONWriter;
25 
26 
27 /// @brief Attribute Interface for file I/O
28 ///
29 /// This class provides an interface used to save and load attributes to and
30 /// from JSON files. This class is responsible for saving and loading the
31 /// private @b data object in an attribute's JSON description.
32 ///
33 /// @section JSON-GA_Attribute-Data JSON Schema: GA_Attribute-Data
34 /// Each attribute can save/load its information in its own JSON attribute
35 /// block. Any data needed by the attribute can be saved in this data block.
36 ///
37 /// @see GA_Attribute, GA_AttributeType, @ref JSON-GA_ATINumeric,
38 /// @ref JSON-GA_ATIString
40 {
41 public:
43  virtual ~GA_AIFJSON() {}
44 
45  /// Save the attribute to JSON stream.
46  /// @param w The JSON writer
47  /// @param attrib The attribute to be saved
48  /// @param save The save map.
49  virtual bool save(UT_JSONWriter &w,
50  const GA_Attribute *attrib,
51  const GA_SaveMap &save) const = 0;
52 
53  /// Load and create a new attribute from a JSON stream.
54  /// @param p @n
55  /// The JSON parser
56  /// @param attrib @n
57  /// The attribute to load
58  /// @param version @n
59  /// The version specified in the attribute definition (the value returned
60  /// by getSaveVersion() when the attribute was saved). Default is 0.
61  /// @param load @n
62  /// The load map
63  /// The detail being loaded should be retrieved by from the
64  /// GA_LoadMap::getDetail() method.
65  virtual bool load(UT_JSONParser &p,
66  GA_Attribute *attrib,
67  int64 save_version,
68  const GA_LoadMap &load) const = 0;
69 
70 protected:
71  /// During saving, this method can get an iterator for the specific
72  /// attribute. The iterator will process the items which need to be
73  /// saved.
74  const GA_Range &getRange(const GA_Attribute *attrib,
75  const GA_SaveMap &map);
76 };
77 
78 #endif
Definition of a geometry attribute.
Definition: GA_Attribute.h:198
Used to pass options and map offset values during saving.
Definition: GA_SaveMap.h:48
virtual ~GA_AIFJSON()
Definition: GA_AIFJSON.h:43
JSON reader class which handles parsing of JSON or bJSON files.
Definition: UT_JSONParser.h:87
#define GA_API
Definition: GA_API.h:14
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:37
A range of elements in an index-map.
Definition: GA_Range.h:42
long long int64
Definition: SYS_Types.h:116
Options during loading.
Definition: GA_LoadMap.h:42
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:857
Attribute Interface for file I/O.
Definition: GA_AIFJSON.h:39