HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
UT_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: IO table definition
7  *
8  * COMMENTS: This class can be used to initialize an IO table for
9  * use in other libraries. For example, to use this class
10  * you can have a static instansiation giving the desired
11  * table name:
12  * static UT_IOTable fbIOtable("FBio", 3)
13  *
14  */
15 
16 #ifndef __UT_IOTable_h__
17 #define __UT_IOTable_h__
18 
19 #include "UT_API.h"
20 #include "UT_LinkList.h"
21 #include "UT_ValArray.h"
22 #include "UT_String.h"
23 
24 // Instantiating a static UT_IOTable requires that the static data in
25 // <tools/henv.C> has already been initialized. Our current mechanism
26 // for ensuring this is to include the header.
27 #include <tools/henv.h>
28 
30 {
31 public:
32  UT_IOEntry(const char *ext, const char *magic, const char *read,
33  const char *write);
34  ~UT_IOEntry();
35 
36  UT_String extension; // File extension
37  unsigned magic; // Magic number
38  UT_String readFrom; // Command to read from an external file type
39  UT_String writeTo; // Command to write to the external file type
40 
41  //
42  // In cases where there are more than three arguments on each
43  // line of the table, the following structure is filled up with
44  // duplicates of each argument
45  //
46  char **argv;
47 };
48 
50 {
51 public:
52  UT_IOTable(const char *path, char commentChar='#');
53  virtual ~UT_IOTable();
54 
55  const UT_IOEntry *findExtension(const UT_String &filename) const;
56  const UT_IOEntry *findMagic(unsigned magic) const;
57 };
58 
60 {
61 public:
62  UT_ExtensionList(const char *filepath, const char *iopath=0);
63  int findExtension(const char *extension) const;
64  int hasSuffix(const char *filename) const;
65  /// Add given extension to the list, if it doesn't already exist.
66  void addExtension(const char *extension);
67  int getExtensions(UT_ValArray<const char *> &list) const;
68  int readFile(const char *filepath);
69  int readIOFile(const char *filepath);
70 
71 private:
72  char **array;
73  int entries;
74 };
75 
78 
81 UT_API extern UT_IOTable *UTgetIOTable(const char *filename);
82 
84 UT_API extern UT_IOTable *UTgetChanTable(const char *filename);
85 
92 
93 #endif
UT_API UT_ExtensionList * UTgetLutExtensions(void)
UT_API UT_ExtensionList * UTgetMidiExtensions(void)
Definition: UT_IOTable.h:29
UT_API UT_ExtensionList * UTgetI3dExtensions(void)
GLsizei const GLchar *const * path
Definition: glcorearb.h:3340
UT_String readFrom
Definition: UT_IOTable.h:38
#define UT_API
Definition: UT_API.h:12
UT_API UT_ExtensionList * UTgetRampExtensions(void)
UT_API UT_ExtensionList * UTgetSimExtensions(void)
void read(T &in, bool &v)
Definition: ImfXdr.h:611
char ** argv
Definition: UT_IOTable.h:46
UT_API UT_ExtensionList * UTgetGeoExtensions(void)
UT_API UT_ExtensionList * UTgetSimdataExtensions(void)
UT_String extension
Definition: UT_IOTable.h:36
UT_API UT_ExtensionList * UTgetCmdExtensions(void)
unsigned magic
Definition: UT_IOTable.h:37
UT_String writeTo
Definition: UT_IOTable.h:39
png_infop png_sPLT_tpp entries
Definition: png.h:2481
UT_API UT_IOTable * UTgetChanTable(const char *filename)
UT_API UT_ExtensionList * UTgetChanExtensions(void)
UT_API UT_ExtensionList * UTgetPicExtensions(void)
virtual bool readFile(GA_Detail &g, const char *filename, const GA_LoadOptions *opts, UT_StringArray *errors) const
Class which defines an I/O interface to save/load geometry.
UT_API UT_ExtensionList * UTgetCaptExtensions(void)
void write(T &out, bool v)
Definition: ImfXdr.h:332
UT_API UT_IOTable * UTgetIOTable(const char *filename)