00001 00002 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 00028 00029 00030 00031 00032 00033 00034 00035 00036 00037 00038 00039 00040 00041 00042 00043 00044 00045 00046 00047 00048 00049 00050 00051 00052 00053 00054 00055
00056
00057 00058 00059 00060 00061 00062 00063 00064 00065 00066 00067 00068 00069 00070 00071 00072 00073 00074 00075 00076
00077
00078
00079 #if !defined(REFARRAY_HPP)
00080 #define REFARRAY_HPP
00081
00082 #include <util/XercesDefs.hpp>
00083 #include <util/ArrayIndexOutOfBoundsException.hpp>
00084 #include <util/IllegalArgumentException.hpp>
00085 #include <util/XMLEnumerator.hpp>
00086
00087
00088 template <class TElem> class RefArrayOf
00089 {
00090 public :
00091
00092
00093
00094 RefArrayOf(const unsigned int size);
00095 RefArrayOf(TElem* values[], const unsigned int size);
00096 RefArrayOf(const RefArrayOf<TElem>& source);
00097 ~RefArrayOf();
00098
00099
00100
00101
00102
00103 TElem*& operator[](const unsigned int index);
00104 const TElem* operator[](const unsigned int index) const;
00105 RefArrayOf<TElem>& operator=(const RefArrayOf<TElem>& toAssign);
00106 bool operator==(const RefArrayOf<TElem>& toCompare) const;
00107 bool operator!=(const RefArrayOf<TElem>& toCompare) const;
00108
00109
00110
00111
00112
00113 unsigned int copyFrom(const RefArrayOf<TElem>& srcArray);
00114
00115
00116
00117
00118
00119 unsigned int length() const;
00120 TElem** rawData() const;
00121
00122
00123
00124
00125
00126 void deleteAt(const unsigned int index);
00127 void deleteAllElements();
00128 void resize(const unsigned int newSize);
00129
00130
00131 private :
00132
00133
00134
00135 unsigned int fSize;
00136 TElem** fArray;
00137 };
00138
00139
00140
00141
00142
00143
00144 template <class TElem> class RefArrayEnumerator : public XMLEnumerator<TElem>
00145 {
00146 public :
00147
00148
00149
00150 RefArrayEnumerator
00151 (
00152 RefArrayOf<TElem>* const toEnum
00153 , const bool adopt = false
00154 );
00155 ~RefArrayEnumerator();
00156
00157
00158
00159
00160
00161 bool hasMoreElements() const;
00162 TElem& nextElement();
00163 void Reset();
00164
00165
00166 private :
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180 bool fAdopted;
00181 unsigned int fCurIndex;
00182 RefArrayOf<TElem>* fToEnum;
00183 };
00184
00185
00186 #if !defined(XERCES_TMPLSINC)
00187 #include <util/RefArrayOf.c>
00188 #endif
00189
00190 #endif