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
00021 namespace tecplot
00022 {
00023 namespace toolbox
00024 {
00025
00030 class TPTOOLBOX_DLLAPI StringList
00031 {
00032 public:
00039 StringList();
00040
00053 explicit StringList(StringList_pa stringList);
00054
00064 StringList(const StringList& stringList);
00065
00076 explicit StringList(const char* first,
00077 ...);
00078
00079 virtual ~StringList();
00080
00081 public:
00082 virtual bool operator==(const StringList& rhs) const;
00083 virtual bool operator!=(const StringList& rhs) const;
00084
00099 virtual void append(const StringList& stringList);
00100
00113 virtual void append(const char* strValue);
00114 virtual inline void append(std::string strValue)
00115 {
00116 append(strValue.c_str());
00117 }
00118
00122 virtual void clear();
00123
00138 virtual void assign(const StringList& stringList);
00139
00162 virtual void assign(const char* strValue,
00163 const char* delimiters = ",",
00164 bool discardEmptyStrings = false);
00165 virtual inline void assign(std::string strValue,
00166 std::string delimiters = ",",
00167 bool discardEmptyStrings = false)
00168 {
00169 assign(strValue.c_str(), delimiters.c_str(), discardEmptyStrings);
00170 }
00171
00189 virtual void insert(LgIndex_t index,
00190 const char* strValue);
00191 virtual inline void insert(LgIndex_t index,
00192 std::string strValue)
00193 {
00194 insert(index, strValue.c_str());
00195 }
00196
00218 virtual void replace(LgIndex_t index,
00219 const char* strValue);
00220 virtual inline void replace(LgIndex_t index,
00221 std::string strValue)
00222 {
00223 replace(index, strValue.c_str());
00224 }
00225
00235 virtual void remove(LgIndex_t index);
00236
00249 virtual void remove(LgIndex_t index,
00250 LgIndex_t count);
00251
00252
00270 virtual void sort(const StringListStringComparator_pf comparator = NULL,
00271 const ArbParam_t clientData = 0);
00272
00273
00280 virtual LgIndex_t size() const;
00281
00291 virtual const char* getStringRef(LgIndex_t index) const;
00292
00302 virtual std::string get(LgIndex_t index) const;
00303
00315 virtual std::string toString(const char* delimiters) const;
00316 virtual inline std::string toString(std::string delimiters) const
00317 {
00318 return toString(delimiters.c_str());
00319 }
00320
00333 virtual StringList_pa getRef() const;
00334
00335 private:
00336 void alloc();
00337 void dealloc();
00338
00339 StringList_pa m_stringList;
00340
00345 StringList& operator = (const StringList& other);
00346 };
00347
00348 }
00349 }
00350
00351 #endif