HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GA_IOTable.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_IOTable.h ( GA Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __GA_IOTable__
12 #define __GA_IOTable__
13 
14 #include "GA_API.h"
15 
16 #include <UT/UT_Array.h>
17 
18 #include <SYS/SYS_Types.h>
19 
20 #include <stddef.h>
21 
22 class GA_IO;
23 class GA_SaveOptions;
24 class GA_LoadOptions;
25 class UT_StringArray;
26 
27 
28 /// Container class to store GA_IO objects for a detail specialization
30 {
31 public:
32  GA_IOTable();
33  ~GA_IOTable();
34 
35  /// Return the token for JSON
36  static const char *getJSONToken()
37  { return "hjson"; }
38  /// Return the token for "classic" .bgeo/.geo formats
39  static const char *getClassicToken()
40  { return "hclassic"; }
41 
42  /// Append or replace an IO entry.
43  /// IO entries are scanned in the order they are added.
44  bool add(GA_IO *io);
45 
46  /// Find an IO entry by name. With no name, the "default" IO class will be
47  /// returned.
48  const GA_IO *find(const char *name=NULL) const;
49 
50  /// @{
51  /// Find an IO entry by looking for the "geo:format" property
52  const GA_IO *find(const GA_SaveOptions *options) const;
53  const GA_IO *find(const GA_LoadOptions *options) const;
54  /// @}
55 
56  /// @{
57  /// Find the IO format which is the best match for the given filename
58  const GA_IO *checkFilename(const char *filename,
59  const GA_SaveOptions *options) const;
60  const GA_IO *checkFilename(const char *filename,
61  const GA_LoadOptions *options) const;
62  /// @}
63 
64  /// Get a list of IO tokens supported
65  void getNames(UT_StringArray &names) const;
66 
67  /// Return the number of GA_IO entries
68  exint entries() const;
69 
70  /// Return the i'th GA_IO item
71  const GA_IO *get(exint i) const;
72 
73  /// Clear the entries
74  void clear();
75 
76  /// Convenience operator
77  const GA_IO *operator()(exint i) const
78  {
79  return get(i);
80  }
81 
82  const UT_Array<GA_IO *> &getList() const { return myList; }
83 
84 private:
85  UT_Array<GA_IO *> myList;
86 };
87 
88 #endif
const UT_Array< GA_IO * > & getList() const
Definition: GA_IOTable.h:82
#define GA_API
Definition: GA_API.h:12
static const char * getClassicToken()
Return the token for "classic" .bgeo/.geo formats.
Definition: GA_IOTable.h:39
png_uint_32 i
Definition: png.h:2877
static const char * getJSONToken()
Return the token for JSON.
Definition: GA_IOTable.h:36
Container class to store GA_IO objects for a detail specialization.
Definition: GA_IOTable.h:29
int64 exint
Definition: SYS_Types.h:109
GLuint const GLchar * name
Definition: glcorearb.h:785
png_infop png_sPLT_tpp entries
Definition: png.h:2481
const GA_IO * operator()(exint i) const
Convenience operator.
Definition: GA_IOTable.h:77
Class to specify options for loading geometry.