|
||
The data in a URI that is delimited into segments can be parsed.
TDelimitedXxxxParser8
classes provide the functionality to parse
delimited data, extract the current segment and parse the string for the next
segment.
TDelimitedXxxxParser8
provides the following
functionality:
Set the delimiter to a specific character using
SetDelimiter()
.
SetDelimiter(TChar('/')); //set the delimiter character to '/'
Note: Set the delimiter before you parse the data.
Parse the data into segments from left to right using
Parse()
.
Parse the data into segments from right to left using
ParseReverse()
.
Parse the data into segments before calling any of the following functions.
Parse to the next segment using Inc()
.
Get the descriptor reference with the data using Des()
.
Get the current segment and parse the data to the next segment using
GetNext()
.
Get the current segment using Peek()
.
Get the remaining data from (and including) the current segment using
Remainder()
.
To use the above functions, you need to use the class derived from
TDelimitedParserBase8
.
The following three classes are used to parse the respective URI components:
TDelimitedPathParser8
for parsing path into
directories seperated by '/'.
For example:
/doc_source/guide/N10047/index.html
TDelimitedPathSegmentParser8
for parsing
parameters that are separated by ';'
For example:
postd=pp22;[email protected];user=phone
TDelimitedQueryParser8
for parsing the query
string (after a '?') into name/value pairs that is separated by '&'.
For example:
sortcol=4&table=1&up=0&view=details
The table shows the delimiter to be used to seperate each of the URI components.
URI Component | Delimiter |
---|---|
Path |
/ |
Path segment |
; |
Query |
& |