# pstring.h File Reference

`#include <string>`
`#include <vector>`
`#include <ptlib/array.h>`

Go to the source code of this file.

## Classes

class | PString
| The character string class. More...
class | PCaselessString
| This class is a variation of a string that ignores case. More...
class | PConstantString< ParentString >
| Create a constant string. More...
class | PStringStream
| This class is a standard C++ stream class descendent for reading or writing streamed data to or from a `PString` class. More...
class | PStringArray
| This is an array collection class of `PString` objects. More...
class | PStringList
| This is a list collection class of `PString` objects. More...
class | PSortedStringList
| This is a sorted list collection class of `PString` objects. More...
class | PStringSet
| This is a set collection class of `PString` objects. More...
class | PStringDictionary< K >
| This template class maps the PAbstractDictionary to a specific key type and a `PString` data type. More...
class | POrdinalToString
| This is a dictionary collection class of `PString` objects, keyed by an ordinal value. More...
struct | POrdinalToString::Initialiser
| Structure for static array initialiser for class. More...
class | PStringToOrdinal
| This is a dictionary collection class of ordinals keyed by `PString` objects. More...
struct | PStringToOrdinal::Initialiser
| Structure for static array initialiser for class. More...
class | PStringToString
| This is a dictionary collection class of `PString` objects, keyed by another string. More...
struct | PStringToString::Initialiser
| Structure for static array initialiser for class. More...
class | PStringOptions
| Specialised version of PStringToString to contain a dictionary of options/attributes. More...
class | PRegularExpression
| A class representing a regular expression that may be used for locating patterns in strings. More...

## Defines

#define | PDECLARE_STRING_DICTIONARY(cls, K)
| Begin declaration of a dictionary of strings class.
#define | PSTRING_DICTIONARY(cls, K) typedef PStringDictionary<K> cls
| Declare a dictionary of strings class.

## Typedefs

typedef PConstantString< PString > | PConstString
| Constant PString type. See PConstantString.
typedef PConstantString< PCaselessString > | PConstCaselessString
| Constant PCaselessString type. See PConstantString.

## Functions

PString | psprintf (const char *fmt,...)
| Produce formatted output as a string.
PString | pvsprintf (const char *fmt, va_list arg)
| Produce formatted output as a string.
| PBASEARRAY (PWCharArray, wchar_t)
ostream & | operator<< (ostream &stream, const PString &string)
wostream & | operator<< (wostream &stream, const PString &string)

## Define Documentation

#define PDECLARE_STRING_DICTIONARY | ( | cls,
|  | K |  | ) |

Value:

    PDECLARE_CLASS(cls, PStringDictionary<K>) \
      protected: \
        cls(int dummy, const cls * c) \
          : PStringDictionary<K>(dummy, c) { } \
      public: \
        cls() \
          : PStringDictionary<K>() { } \
        virtual PObject * Clone() const \
          { return PNEW cls(0, this); } \

Begin declaration of a dictionary of strings class.

This macro is used to declare a descendent of PAbstractList class, customised for a particular key type K and data object type `PString`.

If the compilation is using templates then this macro produces a descendent of the `PStringDictionary` template class. If templates are not being used then the macro defines a set of inline functions to do all casting of types. The resultant classes have an identical set of functions in either case.

See the `PStringDictionary` and `PAbstractDictionary` classes for more information.

#define PSTRING_DICTIONARY | ( | cls,
|  | K |  | ) | typedef PStringDictionary<K> cls

Declare a dictionary of strings class.

This macro is used to declare a descendent of PAbstractDictionary class, customised for a particular key type K and data object type `PString`. This macro closes the class declaration off so no additional members can be added.

If the compilation is using templates then this macro produces a typedef of the `PStringDictionary` template class.

See the `PStringDictionary` class and `PDECLARE_STRING_DICTIONARY` macro for more information.

## Typedef Documentation

typedef PConstantString<PCaselessString> PConstCaselessString

Constant PCaselessString type. See PConstantString.

typedef PConstantString<PString> PConstString

Constant PString type. See PConstantString.

## Function Documentation

wostream& operator<< | ( | wostream & | stream,
|  | const PString & | string |
| ) |  |  | `[inline]`

ostream& operator<< | ( | ostream & | stream,
|  | const PString & | string |
| ) |  |  | `[inline]`

PBASEARRAY | ( | PWCharArray | ,
|  | wchar_t |  |
| ) |  |  |

PString psprintf | ( | const char * | fmt,
|  |  | ... |
| ) |  |  |

Produce formatted output as a string.

..), but returns a PString instead of a const char *.

Parameters:

  fmt | printf style format string

PString pvsprintf | ( | const char * | fmt,
|  | va_list | arg |
| ) |  |  |

Produce formatted output as a string.

Parameters:

  fmt | printf style format string
  arg | Arguments for formatting