00001 #ifndef COIN_SOFIELDDATA_H
00002 #define COIN_SOFIELDDATA_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include <Inventor/SbBasic.h>
00028 #include <Inventor/lists/SbList.h>
00029
00030 class SbName;
00031 class SoField;
00032 class SoFieldContainer;
00033 class SoInput;
00034 class SoOutput;
00035
00036 class SoEnumEntry;
00037 class SoFieldEntry;
00038
00039 class COIN_DLL_API SoFieldData {
00040 public:
00041 SoFieldData(void);
00042 SoFieldData(const SoFieldData & fd);
00043 SoFieldData(const SoFieldData * fd);
00044 SoFieldData(int numfields);
00045 ~SoFieldData();
00046
00047 void addField(SoFieldContainer * base, const char * name,
00048 const SoField * field);
00049
00050 void overlay(SoFieldContainer * to, const SoFieldContainer * from,
00051 SbBool copyconnections) const;
00052
00053 int getNumFields(void) const;
00054 const SbName & getFieldName(int index) const;
00055 SoField * getField(const SoFieldContainer * object, int index) const;
00056 int getIndex(const SoFieldContainer * fc, const SoField * field) const;
00057
00058 void addEnumValue(const char * enumname, const char * valuename, int value);
00059 void getEnumData(const char * enumname,
00060 int & num, const int *& values, const SbName *& names);
00061
00062 SbBool read(SoInput * in, SoFieldContainer * object,
00063 SbBool erroronunknownfield, SbBool & notbuiltin) const;
00064 SbBool read(SoInput * in, SoFieldContainer * object,
00065 const SbName & fieldname, SbBool & foundname) const;
00066 void write(SoOutput * out, const SoFieldContainer * object) const;
00067 void copy(const SoFieldData * src);
00068 SbBool isSame(const SoFieldContainer * c1,
00069 const SoFieldContainer * c2) const;
00070
00071 SbBool readFieldDescriptions(SoInput * in, SoFieldContainer * object,
00072 int numdescriptionsexpected,
00073 const SbBool readfieldvalues = TRUE) const;
00074 void writeFieldDescriptions(SoOutput * out,
00075 const SoFieldContainer * object) const;
00076
00077 private:
00078
00079 enum ControlWord {
00080 NOTBUILTIN = 0x40
00081 };
00082
00083 int operator==(const SoFieldData * fd) const;
00084 int operator!=(const SoFieldData * fd) const { return ! operator==(fd); }
00085 int operator==(const SoFieldData & fd) const { return operator==(&fd); }
00086 int operator!=(const SoFieldData & fd) const { return ! operator==(&fd); }
00087
00088 void freeResources(void);
00089
00090 SbList<SoFieldEntry *> fields;
00091 SbList<SoEnumEntry *> enums;
00092 };
00093
00094 #endif // !COIN_SOFIELDDATA_H