// ============================================================================ // Copyright (C) 2001-2011 by Jozef Starosczyk // ixen@copyhandler.com // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU Library General Public License // (version 2) as published by the Free Software Foundation; // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU Library General Public // License along with this program; if not, write to the // Free Software Foundation, Inc., // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // ============================================================================ /// @file TStringArray.h /// @date 2011/06/05 /// @brief Contains string array definition. // ============================================================================ #ifndef __TSTRINGARRAY_H__ #define __TSTRINGARRAY_H__ #include "TString.h" #include "libchcore.h" BEGIN_CHCORE_NAMESPACE class TReadBinarySerializer; class TWriteBinarySerializer; class LIBCHCORE_API TStringArrayIterator { protected: TStringArrayIterator(std::vector::iterator iterArray); public: TStringArrayIterator(); ~TStringArrayIterator(); TStringArrayIterator operator++(int); TStringArrayIterator& operator++(); bool operator==(const TStringArrayIterator& rSrc) const; bool operator!=(const TStringArrayIterator& rSrc) const; TString& operator*(); const TString& operator*() const; private: #pragma warning(push) #pragma warning(disable: 4251) std::vector::iterator m_iterArray; #pragma warning(pop) friend class TStringArray; }; class LIBCHCORE_API TStringArrayConstIterator { protected: TStringArrayConstIterator(std::vector::const_iterator iterArray); public: TStringArrayConstIterator(); ~TStringArrayConstIterator(); TStringArrayConstIterator operator++(int); TStringArrayConstIterator& operator++(); bool operator==(const TStringArrayConstIterator& rSrc) const; bool operator!=(const TStringArrayConstIterator& rSrc) const; const TString& operator*(); const TString& operator*() const; private: #pragma warning(push) #pragma warning(disable: 4251) std::vector::const_iterator m_iterArray; #pragma warning(pop) friend class TStringArray; }; class LIBCHCORE_API TStringArray { public: typedef TStringArrayIterator iterator; typedef TStringArrayConstIterator const_iterator; public: TStringArray(); ~TStringArray(); bool operator==(const TStringArray& rSrc) const; bool operator!=(const TStringArray& rSrc) const; void Add(const TString& str); void InsertAt(size_t stIndex, const TString& str); void SetAt(size_t stIndex, const TString& str); void RemoveAt(size_t stIndex); void Clear(); const TString& GetAt(size_t stIndex) const; size_t GetCount() const; TStringArrayIterator Begin(); TStringArrayIterator End(); TStringArrayConstIterator Begin() const; TStringArrayConstIterator End() const; void Serialize(TReadBinarySerializer& rSerializer); void Serialize(TWriteBinarySerializer& rSerializer) const; private: #pragma warning(push) #pragma warning(disable: 4251) std::vector m_vItems; #pragma warning(pop) }; END_CHCORE_NAMESPACE #endif