00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00043 
00044 
00045 #ifndef _MBOSTRLIST_H_
00046 #define _MBOSTRLIST_H_
00047 
00048 #include "Mbo.h"
00049 
00050 #include "map2.h"
00051 #include "list2.h"
00052 #include "vector2.h"
00053 #include "MboStrHelper.h"
00054 
00055 #if defined(_MSC_VER)
00056 # pragma warning(push)
00057 # pragma warning(disable: 4251) // disable warning C4251: '...' : class '...' needs to have dll-interface to be used by clients of class '...'
00058 # pragma warning(disable: 4275) // non dll-interface class '...' used as base for dll-interface class '...'
00059 #endif
00060 
00061 namespace mbo {
00062 
00069 #define CStrListContainer std::deque2
00070 
00076 class MBO_API CStrList: public CStrListContainer<MboString> 
00077 {
00078 public:
00079 
00082     CStrList();
00083 
00086     CStrList(_IN const CStrListContainer<MboString> &other);
00087 
00090     explicit CStrList(_IN const MboString & str);
00091 
00094     virtual ~CStrList();
00095 
00104     MboString ToCStr(_IN const MboString & strSplit = ",") const;
00105 
00132     static int Explode(
00133             _IN  const char * szInput, 
00134             _IN  const char * szSplit,
00135             _OUT CStrList &   vstrResult,
00136             _IN  bool         bClearInput = true,
00137             _IN  bool         bTrim       = false
00138         );
00139 
00166     static int Explode(
00167             _IN  const MboString & strInput, 
00168             _IN  const MboString & strSplit,
00169             _OUT CStrList &        vstrResult,
00170             _IN  bool              bClearInput = true,
00171             _IN  bool              bTrim       = false
00172         );
00173 
00187     static int ExplodeZZString(
00188             _IN  const char *      szList, 
00189             _OUT CStrList &        vstrResult,
00190             _IN  bool              bClearInput = true,
00191             _IN  bool              bTrim       = false
00192         );
00193 
00202     virtual bool add_if_prefix_match(
00203             _IN const MboString &  strValue,
00204             _IN const MboString &  strPrefix,
00205             _IN bool               bCaseSensitive = false,
00206             _IN bool               bOnlyNew       = false
00207         );
00208 
00218     CStrList & operator = (_IN const std::deque<MboString> & values);
00219 
00220     
00221 
00222 
00223 
00224 
00225 
00226     
00227 
00228 
00229 
00230 
00231 };
00232 
00233 #ifndef MboStrList0
00234 
00235 #define MboStrList0()                 mbo::CStrList()
00236 #endif
00237 #ifndef MboStrList1
00238 
00239 #define MboStrList1(s1)               mbo::CStrList::dyn_create(1, MboString(_CT(s1)))
00240 #endif
00241 #ifndef MboStrList2
00242 
00243 #define MboStrList2(s1,s2)            mbo::CStrList::dyn_create(2, MboString(_CT(s1)), MboString(_CT(s2)))
00244 #endif
00245 #ifndef MboStrList3
00246 
00247 #define MboStrList3(s1,s2,s3)         mbo::CStrList::dyn_create(3, MboString(_CT(s1)), MboString(_CT(s2)), MboString(_CT(s3)))
00248 #endif
00249 #ifndef MboStrList4
00250 
00251 #define MboStrList4(s1,s2,s3,s4)      mbo::CStrList::dyn_create(4, MboString(_CT(s1)), MboString(_CT(s2)), MboString(_CT(s3)), MboString(_CT(s4)))
00252 #endif
00253 #ifndef MboStrList5
00254 
00255 #define MboStrList5(s1,s2,s3,s4,s5)   mbo::CStrList::dyn_create(5, MboString(_CT(s1)), MboString(_CT(s2)), MboString(_CT(s3)), MboString(_CT(s4)), MboString(_CT(s5)))
00256 #endif
00257 
00258 #ifdef SUPPORT_IOSTREAM
00259 
00272 MBO_API std::ostream& operator<< (
00273         _IN std::ostream&    _Ostr,
00274         _IN const CStrList&  _vstr
00275     );
00276 
00277 #endif // SUPPORT_IOSTREAM
00278 
00279 #ifdef _MSC_VER
00280 # pragma warning(pop)
00281 #endif
00282 
00283 }; 
00284 
00285 #endif //_MBOSTRLIST_H_