PTLib
Version 2.14.3
|
This class describes a HyperText markup Language string as used by the World Wide Web and the PURL
and PHTTP
class.
More...
#include <html.h>
Public Types | |
enum | ElementInSet { InHTML, InHead, InBody, InTitle, InHeading, InDivision, InPreFormat, InAnchor, InNote, InAddress, InBlockQuote, InCredit, InBold, InItalic, InTeleType, InUnderline, InStrikeThrough, InBig, InSmall, InSubscript, InSuperscript, InEmphasis, InCite, InStrong, InCode, InSample, InKeyboard, InVariable, InDefinition, InQuote, InAuthor, InPerson, InAcronym, InAbbrev, InInsertedText, InDeletedText, InList, InListHeading, InDefinitionTerm, InTable, InForm, InSelect, InTextArea, NumElementsInSet } |
enum | TableAttr { NoWrap, Border1, Border2, NoPadding, CellPad1, CellPad2, CellPad4, CellPad8, NoCellSpacing, CellSpace1, CellSpace2, CellSpace4, CellSpace8, AlignLeft, AlignCentre, AlignCenter = AlignCentre, AlignRight, AlignJustify, AlignBaseline, AlignBotton, AlignMiddle, AlignTop } |
enum | DisableCodes { Enabled, Disabled } |
enum | SelectionCodes { NotSelected, Selected } |
enum | CheckedCodes { UnChecked, Checked } |
Public Member Functions | |
PHTML (ElementInSet initialState=NumElementsInSet) | |
Construct a new HTML object. More... | |
PHTML (const char *cstr) | |
PHTML (const PString &str) | |
~PHTML () | |
PHTML & | operator= (const PHTML &html) |
Restart the HTML string output using the specified value as the new title. More... | |
PHTML & | operator= (const PString &str) |
PHTML & | operator= (const char *cstr) |
PHTML & | operator= (char ch) |
PBoolean | Is (ElementInSet elmt) const |
void | Set (ElementInSet elmt) |
void | Clr (ElementInSet elmt) |
void | Toggle (ElementInSet elmt) |
![]() | |
PStringStream () | |
Create a new, empty, string stream. More... | |
PStringStream (PINDEX fixedBufferSize) | |
Create a new, empty, string stream of a fixed size. More... | |
PStringStream (const PString &str) | |
Create a new string stream and initialise it to the provided value. More... | |
PStringStream (const char *cstr) | |
Create a new string stream and initialise it with the provided value. More... | |
virtual | ~PStringStream () |
Destroy the string stream, deleting the stream buffer. More... | |
virtual PString & | MakeEmpty () |
Make the current string empty. More... | |
PStringStream & | operator= (const PStringStream &strm) |
Assign the string part of the stream to the current object. More... | |
PStringStream & | operator= (const PString &str) |
Assign the string to the current object. More... | |
PStringStream & | operator= (const char *cstr) |
Assign the C string to the string stream. More... | |
PStringStream & | operator= (char ch) |
Assign the character to the current object. More... | |
virtual PINDEX | GetLength () const |
Determine the length of the null terminated string. More... | |
![]() | |
virtual PObject * | Clone () const |
Make a complete duplicate of the string. More... | |
virtual Comparison | Compare (const PObject &obj) const |
Get the relative rank of the two strings. More... | |
virtual void | PrintOn (ostream &strm) const |
Output the string to the specified stream. More... | |
virtual void | ReadFrom (istream &strm) |
Input the string from the specified stream. More... | |
virtual PINDEX | HashFunction () const |
Calculate a hash value for use in sets and dictionaries. More... | |
virtual PBoolean | SetSize (PINDEX newSize) |
Set the size of the string. More... | |
virtual PBoolean | IsEmpty () const |
Determine if the string is empty. More... | |
virtual PBoolean | MakeUnique () |
Make this instance to be the one and only reference to the container contents. More... | |
bool | MakeMinimumSize (PINDEX newLength=0) |
Set the actual memory block array size to the minimum required to hold the current string contents. More... | |
bool | operator! () const |
Determine if the string is NOT empty. More... | |
PINDEX | Find (char ch, PINDEX offset=0) const |
Locate the position within the string of the character. More... | |
PINDEX | Find (const PString &str, PINDEX offset=0) const |
Locate the position within the string of the substring. More... | |
PINDEX | Find (const char *cstr, PINDEX offset=0) const |
PINDEX | FindLast (char ch, PINDEX offset=P_MAX_INDEX) const |
Locate the position of the last matching character. More... | |
PINDEX | FindLast (const PString &str, PINDEX offset=P_MAX_INDEX) const |
Locate the position of the last matching substring. More... | |
PINDEX | FindLast (const char *cstr, PINDEX offset=P_MAX_INDEX) const |
Locate the position of the last matching substring. More... | |
PINDEX | FindOneOf (const PString &set, PINDEX offset=0) const |
Locate the position of one of the characters in the set. More... | |
PINDEX | FindOneOf (const char *cset, PINDEX offset=0) const |
Locate the position of one of the characters in the set. More... | |
PINDEX | FindSpan (const PString &set, PINDEX offset=0) const |
Locate the position of character not in the set. More... | |
PINDEX | FindSpan (const char *cset, PINDEX offset=0) const |
Locate the position of character not in the set. More... | |
PINDEX | FindRegEx (const PRegularExpression ®ex, PINDEX offset=0) const |
Locate the position within the string of one of the regular expression. More... | |
PBoolean | FindRegEx (const PRegularExpression ®ex, PINDEX &pos, PINDEX &len, PINDEX offset=0, PINDEX maxPos=P_MAX_INDEX) const |
Locate the position within the string of one of the regular expression. More... | |
PBoolean | MatchesRegEx (const PRegularExpression ®ex) const |
Return true if the entire string matches the regular expression. More... | |
PString & | Replace (const PString &target, const PString &subs, PBoolean all=false, PINDEX offset=0) |
Locate the substring within the string and replace it with the specifed substring. More... | |
PString & | Splice (const PString &str, PINDEX pos, PINDEX len=0) |
Splice the string into the current string at the specified position. More... | |
PString & | Splice (const char *cstr, PINDEX pos, PINDEX len=0) |
Splice the string into the current string at the specified position. More... | |
PString & | Delete (PINDEX start, PINDEX len) |
Remove the substring from the string. More... | |
PString | operator() (PINDEX start, PINDEX end) const |
Extract a portion of the string into a new string. More... | |
PString | Left (PINDEX len) const |
Extract a portion of the string into a new string. More... | |
PString | Right (PINDEX len) const |
Extract a portion of the string into a new string. More... | |
PString | Mid (PINDEX start, PINDEX len=P_MAX_INDEX) const |
Extract a portion of the string into a new string. More... | |
PString | LeftTrim () const |
Create a string consisting of all characters from the source string except all spaces at the beginning of the string. More... | |
PString | RightTrim () const |
Create a string consisting of all characters from the source string except all spaces at the end of the string. More... | |
PString | Trim () const |
Create a string consisting of all characters from the source string except all spaces at the beginning and end of the string. More... | |
PString | ToLower () const |
Create a string consisting of all characters from the source string with all upper case letters converted to lower case. More... | |
PString | ToUpper () const |
Create a string consisting of all characters from the source string with all lower case letters converted to upper case. More... | |
bool | Split (char delimiter, PString &before, PString &after, bool trim=true) const |
Split the string into two substrings around delimiter. More... | |
PStringArray | Tokenise (const PString &separators, PBoolean onePerSeparator=true) const |
Split the string into an array of substrings. More... | |
PStringArray | Tokenise (const char *cseparators, PBoolean onePerSeparator=true) const |
Split the string into an array of substrings. More... | |
PStringArray | Lines () const |
Split the string into individual lines. More... | |
PString () | |
Construct an empty string. More... | |
PString (const PString &str) | |
Create a new reference to the specified string. More... | |
PString (const PCharArray &buf) | |
Create a new reference to the specified buffer. More... | |
PString (const PBYTEArray &buf) | |
Create a new string based on the BYTE array. More... | |
PString (const std::string &str) | |
Create a new string from the specified std::string. More... | |
PString (const char *cstr) | |
Create a string from the C string array. More... | |
PString (const char *cstr, PINDEX len) | |
Create a string from the UCS-2 string array. More... | |
PString (char ch) | |
Create a string from the UCS-2 array. More... | |
PString (short n) | |
Create a string from the integer type. More... | |
PString (unsigned short n) | |
Create a string from the integer type. More... | |
PString (int n) | |
Create a string from the integer type. More... | |
PString (unsigned int n) | |
Create a string from the integer type. More... | |
PString (long n) | |
Create a string from the integer type. More... | |
PString (unsigned long n) | |
Create a string from the integer type. More... | |
PString (ConversionType type, const char *str,...) | |
PString (ConversionType type, unsigned long value, unsigned param=10) | |
PString (ConversionType type, signed long value, unsigned param=10) | |
PString (ConversionType type, unsigned int value, unsigned param=10) | |
PString (ConversionType type, signed int value, unsigned param=10) | |
PString (ConversionType type, unsigned short value, unsigned param=10) | |
PString (ConversionType type, signed short value, unsigned param=10) | |
PString (ConversionType type, unsigned char value, unsigned param=10) | |
PString (ConversionType type, signed char value, unsigned param=10) | |
PString (ConversionType type, double value, unsigned places) | |
PString & | operator= (const PString &str) |
Assign the string to the current object. More... | |
PString & | operator= (const std::string &str) |
Assign the string to the current object. More... | |
PString & | operator= (const char *cstr) |
Assign the C string to the current object. More... | |
PString & | operator= (char ch) |
Assign the character to the current object. More... | |
PString & | operator= (short n) |
Assign a string from the integer type. More... | |
PString & | operator= (unsigned short n) |
Assign a string from the integer type. More... | |
PString & | operator= (int n) |
Assign a string from the integer type. More... | |
PString & | operator= (unsigned int n) |
Assign a string from the integer type. More... | |
PString & | operator= (long n) |
Assign a string from the integer type. More... | |
PString & | operator= (unsigned long n) |
Assign a string from the integer type. More... | |
PString | operator+ (const PString &str) const |
Concatenate two strings to produce a third. More... | |
PString | operator+ (const char *cstr) const |
Concatenate a C string to a PString to produce a third. More... | |
PString | operator+ (char ch) const |
Concatenate a single character to a PString to produce a third. More... | |
PString & | operator+= (const PString &str) |
Concatenate a string to another string, modifiying that string. More... | |
PString & | operator+= (const char *cstr) |
Concatenate a C string to a PString, modifiying that string. More... | |
PString & | operator+= (char ch) |
Concatenate a single character to a PString. More... | |
PString | operator& (const PString &str) const |
Concatenate two strings to produce a third. More... | |
PString | operator& (const char *cstr) const |
Concatenate a C string to a PString to produce a third. More... | |
PString | operator& (char ch) const |
Concatenate a single character to a PString to produce a third. More... | |
PString & | operator&= (const PString &str) |
Concatenate a string to another string, modifiying that string. More... | |
PString & | operator&= (const char *cstr) |
Concatenate a C string to a PString, modifiying that string. More... | |
PString & | operator&= (char ch) |
Concatenate a character to a PString, modifiying that string. More... | |
bool | operator*= (const PString &str) const |
Compare two strings using case insensitive comparison. More... | |
bool | operator== (const PString &str) const |
Compare two strings using the PObject::Compare() function. More... | |
bool | operator!= (const PString &str) const |
Compare two strings using the PObject::Compare() function. More... | |
bool | operator< (const PString &str) const |
Compare two strings using the PObject::Compare() function. More... | |
bool | operator> (const PString &str) const |
Compare two strings using the PObject::Compare() function. More... | |
bool | operator<= (const PString &str) const |
Compare two strings using the PObject::Compare() function. More... | |
bool | operator>= (const PString &str) const |
Compare two strings using the PObject::Compare() function. More... | |
bool | operator*= (const char *cstr) const |
Compare a PString to a C string using a case insensitive compare function. More... | |
bool | operator== (const char *cstr) const |
Compare a PString to a C string using the Compare() function. More... | |
bool | operator!= (const char *cstr) const |
Compare a PString to a C string using the PObject::Compare() function. More... | |
bool | operator< (const char *cstr) const |
Compare a PString to a C string using the PObject::Compare() function. More... | |
bool | operator> (const char *cstr) const |
Compare a PString to a C string using the PObject::Compare() function. More... | |
bool | operator<= (const char *cstr) const |
Compare a PString to a C string using the PObject::Compare() function. More... | |
bool | operator>= (const char *cstr) const |
Compare a PString to a C string using the PObject::Compare() function. More... | |
Comparison | NumCompare (const PString &str, PINDEX count=P_MAX_INDEX, PINDEX offset=0) const |
Compare a string against a substring of the object. More... | |
Comparison | NumCompare (const char *cstr, PINDEX count=P_MAX_INDEX, PINDEX offset=0) const |
Compare a string against a substring of the object. More... | |
PString & | sprintf (const char *cfmt,...) |
Concatenate a formatted output to the string. More... | |
PString & | vsprintf (const PString &fmt, va_list args) |
Concatenate a formatted output to the string. More... | |
PString & | vsprintf (const char *cfmt, va_list args) |
Concatenate a formatted output to the string. More... | |
template<typename T > | |
__inline T | As (T t=T()) const |
Convert the string to any type that can be converted using a stream. More... | |
long | AsInteger (unsigned base=10) const |
Convert the string to an integer value using the specified number base. More... | |
DWORD | AsUnsigned (unsigned base=10) const |
Convert the string to an integer value using the specified number base. More... | |
PInt64 | AsInt64 (unsigned base=10) const |
Convert the string to an integer value using the specified number base. More... | |
PUInt64 | AsUnsigned64 (unsigned base=10) const |
Convert the string to an integer value using the specified number base. More... | |
double | AsReal () const |
Convert the string to a floating point number. More... | |
PBYTEArray | ToPascal () const |
Convert a standard null terminated string to a "pascal" style string. More... | |
PString | ToLiteral () const |
Convert the string to C literal string format. More... | |
PString | FromLiteral (PINDEX &offset) const |
Parse a C literal string format as for PString::ToLiteral(). More... | |
operator const unsigned char * () const | |
Get the internal buffer as a pointer to unsigned characters. More... | |
operator std::string () const | |
Cast the PString to a std::string. More... | |
char * | GetPointerAndSetLength (PINDEX len) |
Get a pointer to the buffer and set the length of the string. More... | |
virtual const char * | GetPointer (PINDEX=0) const |
Get a const pointer to the buffer contents This function overrides the ancestor function that returns a char *. More... | |
![]() | |
PCharArray (PINDEX initialSize=0) | |
Construct a new dynamic array of char. More... | |
PCharArray (char const *buffer, PINDEX length, PBoolean dynamic=true) | |
Construct a new dynamic array of char. More... | |
PCharArray (PContainerReference &reference_) | |
virtual void | PrintOn (ostream &strm) const |
Print the array. More... | |
virtual void | ReadFrom (istream &strm) |
Read the array. More... | |
![]() | |
PBaseArray (PINDEX initialSize=0) | |
Construct a new dynamic array of elements of the specified type. More... | |
PBaseArray (charconst *buffer, PINDEX length, PBoolean dynamic=true) | |
Construct a new dynamic array of elements of the specified type. More... | |
PBoolean | SetAt (PINDEX index, charval) |
Set the specific element in the array. More... | |
char | GetAt (PINDEX index) const |
Get a value from the array. More... | |
void | Attach (const char *buffer, PINDEX bufferSize) |
Attach a pointer to a static block to the base array type. More... | |
char * | GetPointer (PINDEX minSize=0) |
Get a pointer to the internal array and assure that it is of at least the specified size. More... | |
char | operator[] (PINDEX index) const |
Get a value from the array. More... | |
char & | operator[] (PINDEX index) |
Get a reference to value from the array. More... | |
operator charconst * () const | |
Get a pointer to the internal array. More... | |
PBoolean | Concatenate (const PBaseArray &array) |
Concatenate one array to the end of this array. More... | |
![]() | |
PAbstractArray (PINDEX elementSizeInBytes, PINDEX initialSize=0) | |
Create a new dynamic array of initalSize elements of elementSizeInBytes bytes each. More... | |
PAbstractArray (PINDEX elementSizeInBytes, const void *buffer, PINDEX bufferSizeInElements, PBoolean dynamicAllocation) | |
Create a new dynamic array of bufferSizeInElements elements of elementSizeInBytes bytes each. More... | |
void | Attach (const void *buffer, PINDEX bufferSize) |
Attach a pointer to a static block to the base array type. More... | |
void * | GetPointer (PINDEX minSize=1) |
Get a pointer to the internal array and assure that it is of at least the specified size. More... | |
PBoolean | Concatenate (const PAbstractArray &array) |
Concatenate one array to the end of this array. More... | |
![]() | |
PContainer (PINDEX initialSize=0) | |
Create a new unique container. More... | |
PContainer (const PContainer &cont) | |
Create a new refernce to container. More... | |
PContainer & | operator= (const PContainer &cont) |
Assign one container reference to another. More... | |
virtual | ~PContainer () |
Destroy the container class. More... | |
virtual PINDEX | GetSize () const |
Get the current size of the container. More... | |
__inline size_t | size () const |
PBoolean | SetMinSize (PINDEX minSize) |
Set the minimum size of container. More... | |
__inline bool | empty () const |
PBoolean | IsUnique () const |
Determine if container is unique reference. More... | |
![]() | |
unsigned | GetTraceContextIdentifier () const |
Get PTRACE context identifier. More... | |
void | SetTraceContextIdentifier (unsigned id) |
void | GetTraceContextIdentifier (PObject &obj) |
void | GetTraceContextIdentifier (PObject *obj) |
void | SetTraceContextIdentifier (const PObject &obj) |
void | SetTraceContextIdentifier (const PObject *obj) |
virtual | ~PObject () |
template<class CLS > | |
CLS * | CloneAs () const |
As for Clone() but converts to specified type. More... | |
virtual Comparison | CompareObjectMemoryDirect (const PObject &obj) const |
Determine the byte wise comparison of two objects. More... | |
bool | operator== (const PObject &obj) const |
Compare the two objects. More... | |
bool | operator!= (const PObject &obj) const |
Compare the two objects. More... | |
bool | operator< (const PObject &obj) const |
Compare the two objects. More... | |
bool | operator> (const PObject &obj) const |
Compare the two objects. More... | |
bool | operator<= (const PObject &obj) const |
Compare the two objects. More... | |
bool | operator>= (const PObject &obj) const |
Compare the two objects. More... | |
virtual const char * | GetClass (unsigned ancestor=0) const |
Get the current dynamic type of the object instance. More... | |
PBoolean | IsClass (const char *cls) const |
virtual PBoolean | InternalIsDescendant (const char *clsName) const |
Determine if the dynamic type of the current instance is a descendent of the specified class. More... | |
__inline const PObject * | PTraceObjectInstance () const |
Static Public Member Functions | |
static PString | Escape (const char *str) |
Protected Member Functions | |
virtual void | AssignContents (const PContainer &c) |
Copy the container contents. More... | |
Additional Inherited Members | |
![]() | |
PINDEX | m_length |
![]() | |
![]() |
This class describes a HyperText markup Language string as used by the World Wide Web and the PURL
and PHTTP
class.
All of the standard stream I/O operators, manipulators etc will operate on the PString class.
enum PHTML::CheckedCodes |
enum PHTML::DisableCodes |
enum PHTML::ElementInSet |
enum PHTML::TableAttr |
PHTML::PHTML | ( | ElementInSet | initialState = NumElementsInSet | ) |
Construct a new HTML object.
If a title is specified in the constructor then the HEAD, TITLE and BODY elements are output and the string is used in a H1 element.
PHTML::PHTML | ( | const char * | cstr | ) |
cstr | C string representation of the title string. |
PHTML::PHTML | ( | const PString & | str | ) |
str | String representation of the title string. |
PHTML::~PHTML | ( | ) |
|
protectedvirtual |
Copy the container contents.
This copies the contents from one reference to another.
No duplication of contents occurs, for instance if the container is an array, the pointer to the array memory is copied, not the array memory block itself.
This function will get called by the base assignment operator.
Reimplemented from PStringStream.
Referenced by operator=().
void PHTML::Clr | ( | ElementInSet | elmt | ) |
|
static |
PBoolean PHTML::Is | ( | ElementInSet | elmt | ) | const |
Restart the HTML string output using the specified value as the new title.
If title
is empty then no HEAD or TITLE elements are placed into the HTML.
html | HTML stream to make a copy of. |
References AssignContents().
str | String for title in restating HTML. |
References AssignContents().
|
inline |
cstr | String for title in restating HTML. |
References AssignContents(), and PString::PString().
|
inline |
ch | String for title in restating HTML. |
References AssignContents(), and PString::PString().
void PHTML::Set | ( | ElementInSet | elmt | ) |
void PHTML::Toggle | ( | ElementInSet | elmt | ) |