00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __GB_AttributeTable_h__
00021 #define __GB_AttributeTable_h__
00022
00023 #include "GB_API.h"
00024 #include "GB_AttributeElem.h"
00025 #include "GB_AttributeDefines.h"
00026 #include "GB_AttributeDict.h"
00027
00028 class GB_API GB_AttributeTable : public GB_AttributeDict
00029 {
00030 public:
00031 GB_AttributeTable() {}
00032 ~GB_AttributeTable();
00033
00034 GB_AttributeRef append(const char *n, int s, GB_AttribType type,
00035 GB_AttribTypeInfo type_info,
00036 const void *defValue);
00037 GB_AttributeRef appendClone(const GB_Attribute *src);
00038
00039 void destroy(const char *name, int size, GB_AttribType type);
00040
00041
00042 void destroy(const char *name, GB_AttribType type);
00043
00044 void clearAndDestroy(void)
00045 {
00046 GB_AttributeDict::clearAndDestroy();
00047 getAttrib().deleteData();
00048 }
00049
00050 void changeDataSize(int s) { getAttrib().changeSize(s); }
00051 GB_AttributeRef grow(const char *n, int oldsize,
00052 GB_AttribType type,
00053 unsigned int addedsize);
00054
00055
00056
00057
00058
00059
00060
00061 GB_AttributeRef shrink(const char *n, int oldsize, GB_AttribType type,
00062 unsigned int removedsize,
00063 int remove_offset );
00064
00065
00066
00067 const void SYS_DEPRECATED *getAttribData(int n) const
00068 { return getAttrib().castAttribData<const void>(
00069 GB_AttributeRef(n)); }
00070
00071 template<typename T>
00072 T *castAttribData(GB_AttributeRef n)
00073 { return getAttrib().castAttribData<T>(n); }
00074 template<typename T>
00075 const T *castAttribData(GB_AttributeRef n) const
00076 { return getAttrib().castAttribData<const T>(n); }
00077
00078
00079
00080 void sortAs(const GB_AttributeDict &) {};
00081
00082
00083
00084 int save(ostream &os, int binary) const
00085 {
00086 return GB_AttributeDict::save(os, getAttrib(), binary);
00087 }
00088 bool load(UT_IStream &is)
00089 {
00090 return GB_AttributeDict::load(is, getAttrib());
00091 }
00092
00093 const GB_AttributeElem &getElement() const { return myAttribElem; }
00094 GB_AttributeElem &getElement() { return myAttribElem; }
00095
00096 #if !defined(HDK_RELAXED_GB)
00097 private:
00098 #endif
00099
00100
00101 const GB_AttributeData &getAttrib() const
00102 { return myAttribElem.getAttrib(); }
00103 GB_AttributeData &getAttrib()
00104 { return myAttribElem.getAttrib(); }
00105 private:
00106 GB_AttributeElem myAttribElem;
00107
00108 };
00109
00110 #endif