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 #if !defined(REFSTACKOF_HPP)
00079 #define REFSTACKOF_HPP
00080
00081
00082 #include <util/XercesDefs.hpp>
00083 #include <util/ArrayIndexOutOfBoundsException.hpp>
00084 #include <util/EmptyStackException.hpp>
00085 #include <util/RefVectorOf.hpp>
00086 #include <util/XMLEnumerator.hpp>
00087
00088
00089
00090
00091
00092
00093 template <class TElem> class RefStackEnumerator;
00094
00095
00096 template <class TElem> class RefStackOf
00097 {
00098 public :
00099
00100
00101
00102 RefStackOf(const unsigned int initElems, const bool adoptElems = true);
00103 ~RefStackOf();
00104
00105
00106
00107
00108
00109 const TElem* elementAt(const unsigned int index) const;
00110 void push(TElem* const toPush);
00111 const TElem* peek() const;
00112 TElem* pop();
00113 void removeAllElements();
00114
00115
00116
00117
00118
00119 bool empty();
00120 unsigned int curCapacity();
00121 unsigned int size();
00122
00123
00124 private :
00125
00126
00127
00128 friend class RefStackEnumerator<TElem>;
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138 RefVectorOf<TElem> fVector;
00139 };
00140
00141
00142
00143
00144
00145
00146
00147 template <class TElem> class RefStackEnumerator : public XMLEnumerator<TElem>
00148 {
00149 public :
00150
00151
00152
00153 RefStackEnumerator
00154 (
00155 RefStackOf<TElem>* const toEnum
00156 , const bool adopt = false
00157 );
00158 ~RefStackEnumerator();
00159
00160
00161
00162
00163
00164 bool hasMoreElements() const;
00165 TElem& nextElement();
00166 void Reset();
00167
00168
00169 private :
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186 bool fAdopted;
00187 unsigned int fCurIndex;
00188 RefVectorOf<TElem>* fVector;
00189 RefStackOf<TElem>* fToEnum;
00190 };
00191
00192
00193 #if !defined(XERCES_TMPLSINC)
00194 #include <util/RefStackOf.c>
00195 #endif
00196
00197 #endif