PTLib  Version 2.10.4
PStringSet Class Reference

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

#include <pstring.h>

Inheritance diagram for PStringSet:
PSet< T > PAbstractSet PHashTable PCollection PContainer PObject

List of all members.

Public Member Functions

Construction
 PStringSet (PINDEX count, char const *const *strarr, PBoolean caseless=false)
 Create a PStringArray from the array of C strings.
 PStringSet (const PString &str)
 Create a PStringSet containing the single string.
Overrides from class PObject
virtual void ReadFrom (istream &strm)
 Input the contents of the object from the stream.
Operations
void Include (const PString &key)
 Include the spcified string value into the set.
PStringSetoperator+= (const PString &key)
 Include the spcified string value into the set.
void Exclude (const PString &key)
 Exclude the spcified string value from the set.
PStringSetoperator-= (const PString &key)
 Exclude the spcified string value from the set.

Detailed Description

This is a set 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.

Unlike the normal sets, this will delete the PStrings removed from it. This complements the automatic creation of new PString objects when literals or expressions are used.

See the PAbstractSet and PSet classes and PDECLARE_SET macro for more information.


Constructor & Destructor Documentation

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

Create a PStringArray from the array of C strings.

Parameters:
countCount of strings in array
strarrArray of C strings
caselessNew strings are to be PCaselessStrings
PStringSet::PStringSet ( const PString str)

Create a PStringSet containing the single string.

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

Member Function Documentation

void PStringSet::Exclude ( const PString key)

Exclude the spcified string value from the set.

Parameters:
keyString value to remove from set.
void PStringSet::Include ( const PString key)

Include the spcified string value into the set.

Parameters:
keyString value to add to set.
PStringSet& PStringSet::operator+= ( const PString key)

Include the spcified string value into the set.

Parameters:
keyString value to add to set.
PStringSet& PStringSet::operator-= ( const PString key)

Exclude the spcified string value from the set.

Parameters:
keyString value to remove from set.
virtual void PStringSet::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().

Parameters:
strmStream to read the objects contents from.

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