PTLib  Version 2.10.4
PStringList Class Reference

This is a list collection class of PString objects. More...

#include <pstring.h>

Inheritance diagram for PStringList:
PList< T > PAbstractList PCollection PContainer PObject

List of all members.

Public Member Functions

Construction
 PStringList (PINDEX count, char const *const *strarr, PBoolean caseless=false)
 Create a PStringList from the array of C strings.
 PStringList (const PString &str)
 Create a PStringList of length one from the single string.
 PStringList (const PStringArray &array)
 Create a PStringList from the array of strings.
 PStringList (const PSortedStringList &list)
 Create a PStringList from the sorted list of strings.
Overrides from class PObject
virtual void ReadFrom (istream &strm)
 Input the contents of the object from the stream.

Operations

PINDEX AppendString (const PString &str)
 Append a string to the list.
PINDEX InsertString (const PString &before, const PString &str)
 Insert a string into the list.
PINDEX GetStringsIndex (const PString &str) const
 Get the index of the string with the specified value.
PStringListoperator+= (const PStringList &list)
 Concatenate a PString or PStringArray to the list.
PStringListoperator+= (const PString &str)
PStringList operator+ (const PStringList &array)
 Create a new PStringList, and add PString or PStringList to it a new PStringList.
PStringList operator+ (const PString &str)
template<typename stlContainer >
static PStringList container (const stlContainer &vec)
 Create a PStringArray from an STL container.

Detailed Description

This is a list collection class of PString objects.

It has all the usual functions for a collection, with the object types set to PString pointers.

In addition some addition functions are added that take a const PString reference instead of a pointer as most standard collection functions do. This is more convenient for when string expressions are used as parameters to function in the collection.

See the PAbstractList and PList classes and PDECLARE_LIST macro for more information.


Constructor & Destructor Documentation

PStringList::PStringList ( PINDEX  count,
char const *const *  strarr,
PBoolean  caseless = false 
)

Create a PStringList from the array of C strings.

Parameters:
countCount of strings in array
strarrArray of C strings
caselessNew strings are to be PCaselessStrings

Create a PStringList of length one from the single string.

Parameters:
strSingle string to convert to a list of one.

Create a PStringList from the array of strings.

Parameters:
arrayArray of strings to convert to list

Create a PStringList from the sorted list of strings.

Parameters:
listList of strings to convert to list.

Member Function Documentation

PINDEX PStringList::AppendString ( const PString str)

Append a string to the list.

Parameters:
strString to append.

Referenced by container().

template<typename stlContainer >
static PStringList PStringList::container ( const stlContainer &  vec) [inline, static]

Create a PStringArray from an STL container.

References AppendString().

PINDEX PStringList::GetStringsIndex ( const PString str) const

Get the index of the string with the specified value.

A linear search of list is performed to find the string value.

Parameters:
strString value to search for.
PINDEX PStringList::InsertString ( const PString before,
const PString str 
)

Insert a string into the list.

Parameters:
beforeString to insert before.
strString to insert.
PStringList PStringList::operator+ ( const PStringList array)

Create a new PStringList, and add PString or PStringList to it a new PStringList.

Returns:
A new PStringList with the additional elements(s)
PStringList PStringList::operator+ ( const PString str)
PStringList& PStringList::operator+= ( const PStringList list)

Concatenate a PString or PStringArray to the list.

Returns:
The PStringArray with the new items appended
PStringList& PStringList::operator+= ( const PString str)
virtual void PStringList::ReadFrom ( istream &  strm) [virtual]

Input the contents of the object from the stream.

This is primarily used by the standard operator>> function.

The default behaviour reads '\n' separated strings until !strm.good().

Reimplemented from PObject.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines