MboStrList.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002 * Copyright (c) 2001 - 2008 Marcus Boerger.  All rights reserved.
00003 *
00004 * This library is free software; you can redistribute it and/or
00005 * modify it under the terms of the GNU Lesser General Public
00006 * License as published by the Free Software Foundation; either
00007 * version 2.1 of the License, or (at your option) any later version.
00008 *
00009 * This library is distributed in the hope that it will be useful,
00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 * Lesser General Public License for more details.
00013 *
00014 * You should have received a copy of the GNU Lesser General Public
00015 * License along with this library; if not, write to the Free Software
00016 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00017 * ========================================================================= */
00018 
00019 /* ------------------------------------------------------------------------ */
00020 /* Name:      MboStrList.h
00021  *
00022  * Requires:  
00023  * - Mbo.h
00024  * - MboStrHelper.h
00025  * - list2.h
00026  * - vector2.h
00027  * - map2.h
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> // vstr
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     /* std::list based assignment
00221      * \note the list will be emptied before assignment
00222      * \param values container with elements to assign
00223      */
00224 //  CStrList & operator = (_IN const std::list<MboString> & values);
00225 
00226     /* std::vector based assignment
00227      * \note the list will be emptied before assignment
00228      * \param values container with elements to assign
00229      */
00230 //  CStrList & operator = (_IN const std::vector<MboString> & values);
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 }; // namespace mbo
00284 
00285 #endif //_MBOSTRLIST_H_

  Hosted on code.google.com  
© Marcus Börger
Generated on Fri Jan 18 21:21:08 2008 for MBO-lib by doxygen 1.5.4