00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef TECPLOT_TOOLBOX_STRINGLIST_H
00012 #define TECPLOT_TOOLBOX_STRINGLIST_H
00013
00014 #if defined MSWIN
00015 #pragma once
00016 #endif
00017
00018 #include <string>
00019 #include "tptoolbox.h"
00020 #include "OutOfMemoryException.h"
00021
00022 namespace tecplot { namespace toolbox {
00023
00028 class TPTOOLBOX_DLLAPI StringList
00029 {
00030 public:
00037 StringList() throw (OutOfMemoryException);
00038
00051 explicit StringList(StringList_pa stringList) throw (OutOfMemoryException);
00052
00062 StringList(const StringList& stringList) throw (OutOfMemoryException);
00063
00074 explicit StringList(const char* first,
00075 ...) throw (OutOfMemoryException);
00076
00077 virtual ~StringList();
00078
00079 public:
00080 virtual Boolean_t operator==(const StringList& rhs) const;
00081 virtual Boolean_t operator!=(const StringList& rhs) const;
00082
00097 virtual void append(const StringList& stringList) throw (OutOfMemoryException);
00098
00111 virtual void append(const char* strValue) throw (OutOfMemoryException);
00112 virtual inline void append(std::string strValue) throw (OutOfMemoryException)
00113 {
00114 append(strValue.c_str());
00115 }
00116
00120 virtual void clear();
00121
00136 virtual void assign(const StringList& stringList) throw (OutOfMemoryException);
00137
00160 virtual void assign(const char* strValue,
00161 const char* delimiters = ",",
00162 Boolean_t discardEmptyStrings = FALSE) throw (OutOfMemoryException);
00163 virtual inline void assign(std::string strValue,
00164 std::string delimiters = ",",
00165 Boolean_t discardEmptyStrings = FALSE) throw (OutOfMemoryException)
00166 {
00167 assign(strValue.c_str(), delimiters.c_str(), discardEmptyStrings);
00168 }
00169
00187 virtual void insert(LgIndex_t index,
00188 const char* strValue) throw (OutOfMemoryException);
00189 virtual inline void insert(LgIndex_t index,
00190 std::string strValue) throw (OutOfMemoryException)
00191 {
00192 insert(index, strValue.c_str());
00193 }
00194
00216 virtual void replace(LgIndex_t index,
00217 const char* strValue) throw (OutOfMemoryException);
00218 virtual inline void replace(LgIndex_t index,
00219 std::string strValue) throw (OutOfMemoryException)
00220 {
00221 replace(index, strValue.c_str());
00222 }
00223
00233 virtual void remove(LgIndex_t index);
00234
00247 virtual void remove(LgIndex_t index,
00248 LgIndex_t count);
00249
00250
00268 virtual void sort(const StringListStringComparator_pf comparator = NULL,
00269 const ArbParam_t clientData = 0);
00270
00271
00278 virtual LgIndex_t size() const;
00279
00289 virtual const char* const getStringRef(LgIndex_t index) const;
00290
00300 virtual std::string get(LgIndex_t index) const;
00301
00313 virtual std::string toString(const char* delimiters) const;
00314 virtual inline std::string toString(std::string delimiters) const
00315 {
00316 return toString(delimiters.c_str());
00317 }
00318
00331 virtual const StringList_pa getRef() const;
00332
00333 private:
00334 void alloc() throw (OutOfMemoryException);
00335 void dealloc();
00336
00337 StringList_pa m_stringList;
00338
00343 StringList& operator = (const StringList& other);
00344 };
00345
00346 }}
00347
00348 #endif