00001 #ifndef CDBBDBSHARED_COLLECTION_NAME_ITR_HH 00002 #define CDBBDBSHARED_COLLECTION_NAME_ITR_HH 00003 00004 // File and Version Information: 00005 // $Id: CdbBdbSCollectionNameItr.hh,v 1.7 2003/08/13 23:36:20 gapon Exp $ 00006 00007 #include "BdbUtil/Bdb.hh" 00008 #include "ooMap.h" 00009 00010 #include "CdbBase/CdbIItr.hh" 00011 00012 /// The internal implementation for the public iterator for elements of collections 00013 /** 00014 * The iterator will return extract end return the names of elements stored 00015 * in the collection. 00016 * 00017 * NOTE: Pay attention to the implementation of the "clone()" method 00018 * of this iterator. This method does not produce an iterator 00019 * being exactly at the same state as the original one (iterator). 00020 */ 00021 class CdbBdbSCollectionNameItr : public CdbIItr< const char* > { 00022 00023 public: 00024 00025 typedef CdbIItr< const char* >::ValueType ValueType; 00026 typedef CdbIItr< const char* >::InterfaceType InterfaceType; 00027 00028 private: 00029 00030 /// The default constructor (NOT IMPLEMENTED) 00031 /** 00032 * Cause there is no such thing as "default" element. 00033 */ 00034 CdbBdbSCollectionNameItr( ); 00035 00036 /// The copy constructor (NOT IMPLEMENTED) 00037 /** 00038 * This is beause the ooMapItr class does not have the copy constructor too. 00039 */ 00040 CdbBdbSCollectionNameItr( const CdbBdbSCollectionNameItr& theItr ); 00041 00042 /// The assignment operator (NOT IMPLEMENTED) 00043 /** 00044 * This is beause the ooMapItr class does not have the assignment operator too. 00045 */ 00046 CdbBdbSCollectionNameItr& operator=( const CdbBdbSCollectionNameItr& theItr ); 00047 00048 public: 00049 00050 /// The normal constructor 00051 /** 00052 * The (oo-)map object passed as a parameter must not be null. Otherwise 00053 * the constructor will abort the execution. 00054 */ 00055 CdbBdbSCollectionNameItr( const BdbRef( BdbMap )& theMapRef ); 00056 00057 /// The destructor 00058 /** 00059 * Details... 00060 */ 00061 virtual ~CdbBdbSCollectionNameItr( ); 00062 00063 /// Reset an iterator to its initial state. 00064 /** 00065 * This implements the corresponding method of the base class. 00066 * 00067 * @see CdbIItr::reset 00068 * @see CdbStatus 00069 */ 00070 virtual CdbStatus reset( ); 00071 00072 /// Advance an iterator to the next position. 00073 /** 00074 * This implements the corresponding method of the base class. 00075 * 00076 * @see CdbIItr::next() 00077 */ 00078 virtual bool next( ); 00079 00080 /// Obtain the currently reffered value. 00081 /** 00082 * This implements the corresponding method of the base class. 00083 * 00084 * @see CdbIItr::value() 00085 * @see CdbIItr::ValueType 00086 * 00087 * @return the current value the iterator is set on 00088 */ 00089 virtual ValueType value( ); 00090 00091 /// Check if an iterator is valid. 00092 /** 00093 * This implements the corresponding method of the base class. 00094 * 00095 * @see CdbIItr::isValid() 00096 */ 00097 virtual bool isValid( ); 00098 00099 /// Make a clone of itself 00100 /** 00101 * @see CdbIItr::clone() 00102 * 00103 * WARNING: The current implementation of this method will return an instance 00104 * reset to the original state, as if no "next" method has ever been 00105 * called against it, even if the original instance is already 00106 * in the "isValid = true" state. 00107 * The reason of ths is that ooMapItr does not have neither copy ctor, 00108 * nor the assignment operator. 00109 */ 00110 virtual InterfaceType* clone( ) const; 00111 00112 private: 00113 00114 bool _isValid; 00115 bool _hasEverBeenAdvanced; 00116 00117 BdbRef(BdbMap) _mapRef; 00118 00119 ooMapItr _mapItr; 00120 ooString(32) _value; 00121 }; 00122 00123 #endif // CDBBDBSHARED_COLLECTION_NAME_ITR_HH
1.3-rc3