00001
00002
00003
00004
00005
00006
00007 #ifndef __IM_ATTRIB_H_
00008 #define __IM_ATTRIB_H_
00009
00010 #include "im_attrib_flat.h"
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 class imAttribTable
00022 {
00023 imAttribTablePrivate* ptable;
00024 public:
00025
00026
00027
00028
00029 imAttribTable(int hash_size)
00030 { ptable = imAttribTableCreate(hash_size); }
00031
00032
00033 ~imAttribTable()
00034 { imAttribTableDestroy(ptable); ptable = 0; }
00035
00036
00037 int Count() const
00038 { return imAttribTableCount(ptable); }
00039
00040
00041 void RemoveAll()
00042 { imAttribTableRemoveAll(ptable); }
00043
00044
00045 void CopyFrom(const imAttribTable& table)
00046 { imAttribTableCopyFrom(ptable, table.ptable); }
00047
00048
00049
00050
00051
00052 void Set(const char* name, int data_type, int count, const void* data)
00053 { imAttribTableSet(ptable, name, data_type, count, data); }
00054
00055
00056 void UnSet(const char *name)
00057 { imAttribTableUnSet(ptable, name); }
00058
00059
00060
00061
00062 const void* Get(const char *name, int *data_type = 0, int *count = 0) const
00063 { return imAttribTableGet(ptable, name, data_type, count); }
00064
00065
00066 void ForEach(void* user_data, imAttribTableCallback attrib_func) const
00067 { imAttribTableForEach(ptable, user_data, attrib_func); }
00068 };
00069
00070
00071
00072
00073
00074
00075 class imAttribArray
00076 {
00077 imAttribTablePrivate* ptable;
00078 public:
00079
00080
00081 imAttribArray(int count)
00082 { ptable = imAttribArrayCreate(count); }
00083
00084
00085 ~imAttribArray()
00086 { imAttribTableDestroy(ptable); ptable = 0; }
00087
00088
00089 int Count() const
00090 { return imAttribTableCount(ptable); }
00091
00092
00093 void RemoveAll()
00094 { imAttribTableRemoveAll(ptable); }
00095
00096
00097 void CopyFrom(const imAttribArray& table)
00098 { imAttribArrayCopyFrom(ptable, table.ptable); }
00099
00100
00101
00102
00103
00104
00105
00106 void Set(int index, const char* name, int data_type, int count, const void* data)
00107 { imAttribArraySet(ptable, index, name, data_type, count, data); }
00108
00109
00110
00111
00112 const void* Get(int index, char *name = 0, int *data_type = 0, int *count = 0) const
00113 { return imAttribArrayGet(ptable, index, name, data_type, count); }
00114
00115
00116 void ForEach(void* user_data, imAttribTableCallback attrib_func) const
00117 { imAttribTableForEach(ptable, user_data, attrib_func); }
00118 };
00119
00120 #endif