PIP  0.4.0_beta2
Platform-Independent Primitives
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PIStringList Class Reference

Strings array class. More...

Inherits PIDeque< T >.

Public Member Functions

 PIStringList ()
 Contructs empty strings list.
 
 PIStringList (const PIString &str)
 Contructs strings list with one string "str".
 
 PIStringList (const PIString &s0, const PIString &s1)
 Contructs empty strings list with strings "s0" and "s1".
 
 PIStringList (const PIString &s0, const PIString &s1, const PIString &s2)
 Contructs empty strings list with strings "s0", "s1" and "s2".
 
 PIStringList (const PIString &s0, const PIString &s1, const PIString &s2, const PIString &s3)
 Contructs empty strings list with strings "s0", "s1", "s2" and "s3".
 
PIString join (const PIString &delim) const
 Join all strings in one with delimiter "delim" and return it. More...
 
PIStringList & removeStrings (const PIString &value)
 Remove all strings equal "value" and return this. More...
 
PIStringList & removeDuplicates ()
 Remove duplicated strings and return this. More...
 
PIStringList & trim ()
 Trim all strings. More...
 
uint contentSize ()
 Return sum of lengths of all strings.
 

Related Functions

(Note that these are not member functions.)

std::ostream & operator<< (std::ostream &s, const PIStringList &v)
 Output operator to std::ostream (cout)
 

Detailed Description

Strings array class.

This class is based on PIVector<PIString> and expand it functionality.

Member Function Documentation

PIString PIStringList::join ( const PIString &  delim) const
inline

Join all strings in one with delimiter "delim" and return it.

Example:

PIStringList sl("1", "2");
sl << "3";
piCout << sl.join(" < "); // 1 < 2 < 3
PIStringList& PIStringList::removeStrings ( const PIString &  value)
inline

Remove all strings equal "value" and return this.

Example:

PIStringList sl("1", "2");
sl << "1" << "2" << "3";
piCout << sl; // {"1", "2", "1", "2", "3"}
piCout << sl.removeStrings("1"); // {"2", "2", "3"}
PIStringList & PIStringList::removeDuplicates ( )

Remove duplicated strings and return this.

Example:

PIStringList sl("1", "2");
sl << "1" << "2" << "3";
piCout << sl; // {"1", "2", "1", "2", "3"}
piCout << sl.removeDuplicates(); // {"1", "2", "3"}
PIStringList& PIStringList::trim ( )
inline

Trim all strings.

Example: