mbo::CStrList Class Reference

default CStr container More...

#include <MboStrList.h>

Inheritance diagram for mbo::CStrList:

Inheritance graph
{std::deque2\< std::basic_string \>\n||+ limit()\l+ position()\l+ contains()\l+ contains_no()\l+ add_if_new()\l+ operator bool()\l+ sort()\l+ dyn_create()\l}
[legend]
Collaboration diagram for mbo::CStrList:

Collaboration graph
{std::deque2\< std::basic_string \>\n||+ limit()\l+ position()\l+ contains()\l+ contains_no()\l+ add_if_new()\l+ operator bool()\l+ sort()\l+ dyn_create()\l}
[legend]

List of all members.

Public Member Functions

 CStrList ()
 CStrList (const std::deque2< MboString > &other)
 CStrList (const MboString &str)
virtual ~CStrList ()
MboString ToCStr (const MboString &strSplit=",") const
virtual bool add_if_prefix_match (const MboString &strValue, const MboString &strPrefix, bool bCaseSensitive=false, bool bOnlyNew=false)
CStrListoperator= (const std::deque< MboString > &values)

Static Public Member Functions

static int Explode (const char *szInput, const char *szSplit, CStrList &vstrResult, bool bClearInput=true, bool bTrim=false)
static int Explode (const MboString &strInput, const MboString &strSplit, CStrList &vstrResult, bool bClearInput=true, bool bTrim=false)
static int ExplodeZZString (const char *szList, CStrList &vstrResult, bool bClearInput=true, bool bTrim=false)


Detailed Description

default CStr container

Note:
Optional iostream support is guarded by compiler define SUPPORT_IOSTREAM.

Definition at line 76 of file MboStrList.h.


Constructor & Destructor Documentation

mbo::CStrList::CStrList (  ) 

empty default constructor

mbo::CStrList::CStrList ( const std::deque2< MboString > &  other  ) 

copy constructor also takes base type

mbo::CStrList::CStrList ( const MboString str  )  [explicit]

construct string list from single value.

virtual mbo::CStrList::~CStrList (  )  [virtual]

virtual destructor


Member Function Documentation

MboString mbo::CStrList::ToCStr ( const MboString strSplit = ","  )  const

Make flat string from list.

	   <value1> "," <value2> ...
	 

Parameters:
strSplit The string used to split the single values
Returns:
returns comma separated list

static int mbo::CStrList::Explode ( const char *  szInput,
const char *  szSplit,
CStrList vstrResult,
bool  bClearInput = true,
bool  bTrim = false 
) [static]

Exlode a string split by another string into a string list.

The input string is split at every occurance of szSplit which will not be included in the any of the resulting string parts stored in the list.

Parameters:
szInput Input string
szSplit String used to split the input
Return values:
vstrResult Resulting string list
Parameters:
bClearInput Whether vstrResult should be cleared or not (defaults to true)
bTrim Whether to trim the resulting string parts.
Returns:
The number of elements in the resulting string list. If the string list was not empty on call and bClearInput is false then this value contains also the elements that were already in the string list upon calling the method. If this value is 0 then the input string was empty. If this value is 1 then the input string did not contain the split string (or vstrResult was not empty upcon call).
Note:
szSplit should not be empty, if so the the resulting string list will simply contain the input string as one single element.

The function cannot be used to split strings split by double zero characters. For that

See also:
ExplodeZZString().

static int mbo::CStrList::Explode ( const MboString strInput,
const MboString strSplit,
CStrList vstrResult,
bool  bClearInput = true,
bool  bTrim = false 
) [static]

Exlode a string split by another string into a string list.

The input string is split at every occurance of szSplit which will not be included in the any of the resulting string parts stored in the list.

Parameters:
strInput Input string
strSplit String used to split the input
Return values:
vstrResult Resulting string list
Parameters:
bClearInput Whether vstrResult should be cleared or not (defaults to true)
bTrim Whether to trim the resulting string parts.
Returns:
The number of elements in the resulting string list. If the string list was not empty on call and bClearInput is false then this value contains also the elements that were already in the string list upon calling the method. If this value is 0 then the input string was empty. If this value is 1 then the input string did not contain the split string (or vstrResult was not empty upcon call).
Note:
szSplit should not be empty, if so the the resulting string list will simply contain the input string as one single element.

The function cannot be used to split strings split by double zero characters. For that

See also:
ExplodeZZString().

static int mbo::CStrList::ExplodeZZString ( const char *  szList,
CStrList vstrResult,
bool  bClearInput = true,
bool  bTrim = false 
) [static]

Convert a list of c strings (zero terminated) that is terminated by an empty string (e.g. two zero characters '\0') into a CStrList.

Parameters:
szList input list terminated by two zero characters.
Return values:
vstrResult will retrieve the result
Parameters:
bClearInput whether or not the vstrResult has to be cleared before inserting the contents of szList
bTrim Whether to trim the resulting string parts.
Returns:
The number of elements in the resulting string list. If the string list was not empty on call and bClearInput is false then this value contains also the elements that were already in the string list upon calling the method.

virtual bool mbo::CStrList::add_if_prefix_match ( const MboString strValue,
const MboString strPrefix,
bool  bCaseSensitive = false,
bool  bOnlyNew = false 
) [virtual]

Add a value if it matches a given prefix.

Parameters:
strValue Value to insert
strPrefix Prefix to match
bCaseSensitive Whether or not comaprison is done case sensitive.
bOnlyNew Add value only if it is new to the list.
Returns:
true if the value is added false otherwise.

CStrList& mbo::CStrList::operator= ( const std::deque< MboString > &  values  ) 

std::deque based assignment

Note:
the list will be emptied before assignment if you don't want this behaviour use std::map2::operator+= which also accepts input from any container with any value type that can be converted to CStr

if you want to assign container with other value types you must use std::map2::operatot<<

Parameters:
values container with elements to assign


The documentation for this class was generated from the following file:
  Hosted on code.google.com  
© Marcus Börger
Generated on Fri Jan 18 21:21:12 2008 for MBO-lib by doxygen 1.5.4