00001 #ifndef _CDBCHARACTERVECTOR_H 00002 #define _CDBCHARACTERVECTOR_H 1 00003 00004 #include "string_forward.h" 00005 00016 class CDBcharacterVector { 00017 public: 00024 class CDBcharacterIterator { 00025 friend class CDBcharacterVector; 00026 public: 00027 CDBcharacterIterator(Mchar *ptr = 0); 00028 CDBcharacterIterator(const CDBcharacterIterator &ref); 00029 ~CDBcharacterIterator(); 00030 00032 void next(); 00034 void prev(); 00035 00036 CDBcharacterIterator &operator++(); 00037 CDBcharacterIterator operator++(int); 00038 CDBcharacterIterator &operator=(const CDBcharacterIterator &ref); 00039 bool operator==(const CDBcharacterIterator &ref) const; 00040 bool operator!=(const CDBcharacterIterator &ref) const; 00041 CDBcharacterIterator operator+(int p) const; 00042 CDBcharacterIterator operator-(int p) const; 00043 const Mchar &operator*() const; 00044 Mchar &operator*(); 00045 int operator-(const CDBcharacterIterator &ref) const; 00046 00047 private: 00048 Mchar *m_Ptr; 00049 }; 00050 00051 CDBcharacterVector(); 00052 virtual ~CDBcharacterVector(); 00053 00055 void destroy(); 00056 00058 void assign(const Mchar *p, size_t len = 0); 00059 00061 void assign(const CDBcharacterIterator &from, const CDBcharacterIterator &to); 00062 00064 void resize(size_t len); 00065 00067 const Mchar *data() const; 00068 00070 size_t length() const; 00071 00073 const CDBcharacterIterator begin() const; 00074 00076 const CDBcharacterIterator end() const; 00077 00079 CDBcharacterIterator begin(); 00080 00082 CDBcharacterIterator end(); 00083 00085 inline Mchar &front() { 00086 return m_Data[0]; 00087 } 00088 00090 inline const Mchar &front() const { 00091 return m_Data[0]; 00092 } 00093 00094 protected: 00095 Mchar *m_Data; 00096 size_t m_DataLen; 00097 }; 00098 00099 #endif