pstring.h File Reference

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

Go to the source code of this file.

Classes

class  PString
class  PCaselessString
class  PStringStream
class  PStringArray
class  PStringList
class  PSortedStringList
class  PStringSet
class  POrdinalToString
struct  POrdinalToString::Initialiser
 Structure for static array initialiser for class. More...
class  PStringToOrdinal
struct  PStringToOrdinal::Initialiser
 Structure for static array initialiser for class. More...
class  PStringToString
struct  PStringToString::Initialiser
 Structure for static array initialiser for class. More...
class  PRegularExpression

Defines

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

Functions

ostream & operator<< (ostream &stream, const PString &string)
PString psprintf (const char *cfmt,...)


Define Documentation

#define PDECLARE_STRING_DICTIONARY ( cls,
 ) 

Value:

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

#define PSTRING_DICTIONARY ( cls,
 ) 

Value:

class cls : public PAbstractDictionary { \
  PCLASSINFO(cls, PAbstractDictionary) \
  protected: \
    inline cls(int dummy, const cls * c) \
      : PAbstractDictionary(dummy, c) { } \
  public: \
    inline cls() \
      : PAbstractDictionary() { } \
    inline PObject * Clone() const \
      { return PNEW cls(0, this); } \
    inline PString & operator[](const K & key) const \
      { return (PString &)GetRefAt(key); } \
    inline PString operator()(const K & key, const char * dflt = "") const \
      { if (Contains(key)) return (PString &)GetRefAt(key); return dflt; } \
    virtual BOOL Contains(const K & key) const \
      { return AbstractContains(key); } \
    virtual PString * RemoveAt(const K & key) \
      { PString * s = GetAt(key); AbstractSetAt(key, NULL); \
        return reference->deleteObjects ? (s ? (PString *)-1 : NULL) : s; } \
    virtual PString * GetAt(const K & key) const \
      { return (PString *)AbstractGetAt(key); } \
    virtual BOOL SetDataAt(PINDEX index, const PString & str) \
      { return PAbstractDictionary::SetDataAt(index,PNEW PString(str));} \
    virtual BOOL SetAt(const K & key, const PString & str) \
      { return AbstractSetAt(key, PNEW PString(str)); } \
    inline const K & GetKeyAt(PINDEX index) const \
      { return (const K &)AbstractGetKeyAt(index); } \
    inline PString & GetDataAt(PINDEX index) const \
      { return (PString &)AbstractGetDataAt(index); } \
  }


Function Documentation

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

PString psprintf ( const char *  cfmt,
  ... 
)

Produce formatted output as a string. This is identical to the standard C library sprintf()# function, but sends its output to a PString#.

This function makes the assumption that there is less the 1000 characters of formatted output. The function will assert if this occurs.

Note that this function will break the current instance from multiple references to the string. A new string buffer is allocated and the data from the old string buffer copied to it.

Returns:
reference to the current string object.
Parameters:
cfmt  C string for output format.


Generated on Fri Mar 7 06:25:03 2008 for PTLib by  doxygen 1.5.1