Helper class that implements a Print interface to accumulate XML data and then parse it using XMLParser.
More...
#include <XMLParserPrint.h>
|
| struct | CBRef |
| | Internal callback reference used to capture the callback data from XMLParser and forward it to the caller. More...
|
| |
|
| | XMLParserPrint () |
| | Constructor.
|
| |
| size_t | write (uint8_t ch) override |
| | Writes a single byte to the buffer (Print interface)
|
| |
| size_t | write (const uint8_t *data, size_t size) override |
| | Writes a block of data to the buffer (Print interface)
|
| |
| void | setExpandEncoded (bool flag) |
| | Forwards expand-entities setting to the underlying XMLParser.
|
| |
| bool | parse (Str &outNodeName, Vector< Str > &outPath, Str &outText, Str &outAttributes) |
| | Parses the accumulated XML data and returns results via output parameters.
|
| |
| void | end () |
| | Resets the internal buffer.
|
| |
| const char * | c_str () |
| | Returns the internal buffer as a C string.
|
| |
| size_t | length () |
| | Returns the length of the internal buffer.
|
| |
|
| static void | wrapperCallback (Str &nodeName, Vector< Str > &path, Str &text, Str &attributes, int start, int len, void *ref) |
| | Static wrapper used as XMLParser callback. Copies the first invocation's data into the CBRef and forwards the event to the user-provided callback if present.
|
| |
Helper class that implements a Print interface to accumulate XML data and then parse it using XMLParser.
This class allows you to write XML data using the Print interface, accumulate it in an internal buffer, and then parse the buffer using an XMLParser. The parsing result is returned via output parameters.
◆ XMLParserPrint()
| tiny_dlna::XMLParserPrint::XMLParserPrint |
( |
| ) |
|
|
inline |
◆ c_str()
| const char * tiny_dlna::XMLParserPrint::c_str |
( |
| ) |
|
|
inline |
Returns the internal buffer as a C string.
- Returns
- Pointer to buffer data
◆ end()
| void tiny_dlna::XMLParserPrint::end |
( |
| ) |
|
|
inline |
Resets the internal buffer.
◆ length()
| size_t tiny_dlna::XMLParserPrint::length |
( |
| ) |
|
|
inline |
Returns the length of the internal buffer.
- Returns
- Buffer length
◆ parse()
| bool tiny_dlna::XMLParserPrint::parse |
( |
Str & |
outNodeName, |
|
|
Vector< Str > & |
outPath, |
|
|
Str & |
outText, |
|
|
Str & |
outAttributes |
|
) |
| |
|
inline |
Parses the accumulated XML data and returns results via output parameters.
- Parameters
-
| outNodeName | Output: node name |
| outPath | Output: path vector |
| outText | Output: text content |
| outAttributes | Output: attributes string |
- Returns
- True if parsing was successful, false otherwise
◆ setExpandEncoded()
| void tiny_dlna::XMLParserPrint::setExpandEncoded |
( |
bool |
flag | ) |
|
|
inline |
Forwards expand-entities setting to the underlying XMLParser.
- Parameters
-
| flag | If true, expand encoded entities |
◆ wrapperCallback()
| static void tiny_dlna::XMLParserPrint::wrapperCallback |
( |
Str & |
nodeName, |
|
|
Vector< Str > & |
path, |
|
|
Str & |
text, |
|
|
Str & |
attributes, |
|
|
int |
start, |
|
|
int |
len, |
|
|
void * |
ref |
|
) |
| |
|
inlinestaticprotected |
Static wrapper used as XMLParser callback. Copies the first invocation's data into the CBRef and forwards the event to the user-provided callback if present.
- Parameters
-
| nodeName | Name of the node |
| path | Path vector |
| text | Text content |
| attributes | Attributes string |
| start | Start position |
| len | Length |
| ref | Reference to CBRef |
◆ write() [1/2]
| size_t tiny_dlna::XMLParserPrint::write |
( |
const uint8_t * |
data, |
|
|
size_t |
size |
|
) |
| |
|
inlineoverride |
Writes a block of data to the buffer (Print interface)
- Parameters
-
| data | Pointer to data |
| size | Number of bytes to write |
- Returns
- Number of bytes written
◆ write() [2/2]
| size_t tiny_dlna::XMLParserPrint::write |
( |
uint8_t |
ch | ) |
|
|
inlineoverride |
Writes a single byte to the buffer (Print interface)
- Parameters
-
- Returns
- Number of bytes written
◆ buffer
| StrPrint tiny_dlna::XMLParserPrint::buffer |
|
protected |
Internal buffer for accumulating XML data.
◆ cbref
The documentation for this class was generated from the following file: