00001 /* 00002 * PROPRIETARY INFORMATION. This software is proprietary to 00003 * Side Effects Software Inc., and is not to be reproduced, 00004 * transmitted, or disclosed in any way without written permission. 00005 * 00006 * Produced by: 00007 * Mark Elendt 00008 * Side Effects Software Inc. 00009 * 20 Maud St. 00010 * Toronto, Ontario, M5V 2M5 00011 * Canada 00012 * 416-366-4607 00013 * 00014 * NAME: IO table definition 00015 * 00016 * COMMENTS: This class can be used to initialize an IO table for 00017 * use in other libraries. For example, to use this class 00018 * you can have a static instansiation giving the desired 00019 * table name: 00020 * static UT_IOTable fbIOtable("FBio", 3) 00021 * 00022 */ 00023 00024 #ifndef __UT_IOTable_h__ 00025 #define __UT_IOTable_h__ 00026 00027 #include "UT_API.h" 00028 #include "UT_LinkList.h" 00029 #include "UT_PtrArray.h" 00030 #include "UT_String.h" 00031 00032 class UT_API UT_IOEntry : public UT_LinkNode 00033 { 00034 public: 00035 UT_IOEntry(const char *ext, const char *magic, const char *read, 00036 const char *write); 00037 ~UT_IOEntry(); 00038 00039 UT_String extension; // File extension 00040 unsigned magic; // Magic number 00041 UT_String readFrom; // Command to read from an external file type 00042 UT_String writeTo; // Command to write to the external file type 00043 00044 // 00045 // In cases where there are more than three arguments on each 00046 // line of the table, the following structure is filled up with 00047 // duplicates of each argument 00048 // 00049 char **argv; 00050 }; 00051 00052 class UT_API UT_IOTable : public UT_LinkList 00053 { 00054 public: 00055 UT_IOTable(const char *path, char commentChar='#'); 00056 virtual ~UT_IOTable(); 00057 00058 const UT_IOEntry *findExtension(const UT_String &filename) const; 00059 const UT_IOEntry *findMagic(unsigned magic) const; 00060 }; 00061 00062 class UT_API UT_ExtensionList 00063 { 00064 public: 00065 UT_ExtensionList(const char *filepath, const char *iopath=0); 00066 int findExtension(const char *extension) const; 00067 int hasSuffix(const char *filename) const; 00068 void addExtension(const char *extension); 00069 int getExtensions(UT_PtrArray<const char *> &list) const; 00070 int readFile(const char *filepath); 00071 int readIOFile(const char *filepath); 00072 00073 private: 00074 char **array; 00075 int entries; 00076 }; 00077 00078 UT_API extern UT_ExtensionList *UTgetPicExtensions(void); 00079 UT_API extern UT_ExtensionList *UTgetRampExtensions(void); 00080 00081 UT_API extern UT_ExtensionList *UTgetGeoExtensions(void); 00082 UT_API extern UT_ExtensionList *UTgetCaptExtensions(void); 00083 UT_API extern UT_IOTable *UTgetIOTable(const char *filename); 00084 00085 UT_API extern UT_ExtensionList *UTgetChanExtensions(void); 00086 UT_API extern UT_IOTable *UTgetChanTable(const char *filename); 00087 00088 UT_API extern UT_ExtensionList *UTgetLutExtensions(void); 00089 UT_API extern UT_ExtensionList *UTgetCmdExtensions(void); 00090 UT_API extern UT_ExtensionList *UTgetMidiExtensions(void); 00091 UT_API extern UT_ExtensionList *UTgetI3dExtensions(void); 00092 UT_API extern UT_ExtensionList *UTgetSimExtensions(void); 00093 UT_API extern UT_ExtensionList *UTgetSimdataExtensions(void); 00094 00095 #endif
1.5.9