Home / Open source / Terimber 2.0
byte_manager Class Referencebase class for utf-8 stream management with additional stack support however the parsing process assumes that some entries must be substituted so we need additional store like stack
More...
#include <mngxml.h>
List of all members.
|
Protected Member Functions |
| byte_manager (byte_source &stream, xml_document &doc, mem_pool_t &small_pool, mem_pool_t &big_pool, size_t xml_size) |
| constructor
|
| ~byte_manager () |
| destructor
|
xml_forceinline ub1_t | pick () |
| picks the byte
|
xml_forceinline ub1_t | pop () |
| pops the byte like operator++(int)
|
xml_forceinline ub1_t | pip () |
| picks than pop like operator++()
|
xml_forceinline void | skip_white_space (bool mustPresent=false, const char *message=0) |
| skips white spaces
|
xml_forceinline void | push (ub1_t x) |
| pushes byte back on top of buffer
|
xml_forceinline void | push (const ub1_t *x, size_t len) |
| pushes array of bytes back to buffer
|
xml_forceinline void | throw_exception (const char *msg_text) |
| throws exception, adding line and char position info
|
xml_forceinline void | skip_string (const char *x, const char *message) |
| skips specified string if not found throw exception
|
xml_forceinline void | skip_sign (ub1_t symbol, bool skip_before, bool skip_after, const char *message) |
| skips symbol with optional white spaces around it
|
xml_forceinline ub1_t | skip_quote (ub1_t symbol=0) |
| skips quote symbol (single or double) if input param is zero returns what type of quote has been found
|
const char * | parseQuotedValue (bool resolve_entities, bool normalize, bool(*fn)(ub1_t), const char *message) |
| parses value wrapped with quoted symbols like '"' | "'" name '"' | "'"
|
xml_forceinline const char * | parseName () |
| parses xml valid name
|
const char * | parseValue () |
| parses xml valid value
|
void | parseAttributeValue (string_t &name, string_t &value) |
| parses attribute style xml part like: name S? = S? '"' | "'" value '"' | "'" returns the name and value
|
void | parseComment () |
| parses comment [15] Comment ::= ''
|
void | parseExternalID (string_t &value_system, string_t &value_public, bool public_strick) |
| parses external ID [75] ExternalID ::= 'SYSTEM' S SystemLiteral | 'PUBLIC' S PubidLiteral S SystemLiteral [76] NDataDecl ::= S 'NDATA' S Name
|
void | parsePI () |
| parses processing instruction
|
void | parseCharRef (paged_buffer &buffer) |
| parses xml valid char &#[0-9]+ | &x[0-9;a-F]+
|
bool | resolveEntity (paged_buffer &buffer) |
| resolves entity
|
bool | get_subset () const |
| returns the current subset value
|
size_t | get_standalone () const |
| returns the current standalone value
|
size_t | get_version () const |
| returns the current version
|
xml_forceinline void | reset_all_tmp (bool reset_allocator=false) |
| resets internal temporary allocator and buffers
|
Protected Attributes |
const size_t | _xml_size |
| xml size tip
|
mem_pool_t & | _small_pool |
| small memory pool
|
mem_pool_t & | _big_pool |
| big memory pool
|
byte_allocator * | _depot_store1_allocator |
| depot store #1 allocator
|
byte_allocator * | _depot_store2_allocator |
| depot store #2 allocator
|
byte_allocator * | _depot_store3_allocator |
| depot store #3 allocator
|
byte_allocator * | _tmp_allocator |
| temporary allocator
|
byte_allocator * | _tmp_store1_allocator |
| temporary store #1 allocator
|
byte_allocator * | _tmp_store2_allocator |
| temporary store #2 allocator
|
byte_allocator * | _tmp_store3_allocator |
| temporary store #3 allocator
|
byte_allocator * | _entity_allocator |
| entity allocator
|
xml_document & | _doc |
| document that will hold the xml and grammar
|
byte_source & | _stream |
| stream of bytes as input xml
|
entity_map_t | _entity_map |
paged_buffer | _tmp_store1 |
| there are situation while parsing when we need three temporary containars simultaniously
|
paged_buffer | _tmp_store2 |
paged_buffer | _tmp_store3 |
Private Types |
typedef _map< const entityDecl
*, size_t > | entity_map_t |
| map of entires to the counts
|
Detailed Description
base class for utf-8 stream management with additional stack support however the parsing process assumes that some entries must be substituted so we need additional store like stack
Definition at line 44 of file mngxml.h.
Member Typedef Documentation
map of entires to the counts
Definition at line 48 of file mngxml.h.
Constructor & Destructor Documentation
constructor
- Parameters:
-
stream |
stream of bytes as input xml |
doc |
document that will hold the xml and grammar |
small_pool |
small pool of allocators |
big_pool |
big pool of allocators |
Definition at line 48 of file mngxml.cpp.
byte_manager::~byte_manager |
( |
|
) |
[protected] |
destructor
Definition at line 79 of file mngxml.cpp.
References _big_pool, _depot_store1_allocator, _depot_store2_allocator, _depot_store3_allocator, _entity_allocator, _small_pool, _tmp_allocator, _tmp_store1_allocator, _tmp_store2_allocator, _tmp_store3_allocator, _xml_size, os_def_size, and pool< C >::return_object().
Member Function Documentation
BEGIN_TERIMBER_NAMESPACE xml_forceinline ub1_t byte_manager::pick |
( |
|
) |
[protected] |
picks the byte
inline functions
Definition at line 46 of file mngxml.hpp.
References _stream, and byte_source::pick().
Referenced by xml_processor::_parseCharData(), dtd_processor::expandPEReference(), xml_processor::parse(), dtd_processor::parseAttDef(), dtd_processor::parseAttrEnumeration(), xml_processor::parseAttributes(), dtd_processor::parseAttrList(), xml_processor::parseCDATA(), xml_processor::parseCharData(), parseCharRef(), dtd_processor::parseChildren(), parseComment(), xml_processor::parseContent(), dtd_processor::parseContentSpec(), dtd_processor::parseDefaultDecl(), xml_processor::parseDocTypeDecl(), xml_processor::parseElement(), dtd_processor::parseEntity(), dtd_processor::parseEntityDef(), parseExternalID(), dtd_processor::parseIgnore(), xml_processor::parseMisc(), dtd_processor::parseMixed(), parseName(), dtd_processor::parsePEReference(), parsePI(), xml_processor::parseProlog(), parseQuotedValue(), xml_processor::parseStartTag(), dtd_processor::parseSubSet(), parseValue(), and resolveEntity().
xml_forceinline ub1_t byte_manager::pop |
( |
|
) |
[protected] |
pops the byte like operator++(int)
Definition at line 53 of file mngxml.hpp.
References _stream, and byte_source::pop().
Referenced by xml_processor::_parseCharData(), dtd_processor::checkRepeation(), dtd_processor::expandPEReference(), dtd_processor::parseAttDef(), dtd_processor::parseAttrEnumeration(), dtd_processor::parseAttrList(), xml_processor::parseCDATA(), parseCharRef(), dtd_processor::parseChildren(), parseComment(), xml_processor::parseContent(), dtd_processor::parseContentSpec(), dtd_processor::parseDefaultDecl(), xml_processor::parseDocTypeDecl(), xml_processor::parseDTD(), xml_processor::parseElement(), dtd_processor::parseEntity(), dtd_processor::parseEntityDef(), dtd_processor::parseIgnore(), xml_processor::parseMisc(), dtd_processor::parseMixed(), parseName(), parsePI(), xml_processor::parseProlog(), parseQuotedValue(), xml_processor::parseStartTag(), dtd_processor::parseSubSet(), parseValue(), resolveEntity(), and xml_processor::skipDTD().
xml_forceinline ub1_t byte_manager::pip |
( |
|
) |
[protected] |
xml_forceinline void byte_manager::skip_white_space |
( |
bool |
mustPresent = false , |
|
|
const char * |
message = 0 | |
|
) |
| | [protected] |
skips white spaces
- Parameters:
-
mustPresent |
white space must be there |
message |
optional error message for exception |
Definition at line 67 of file mngxml.hpp.
References _stream, and byte_source::skip_white_space().
Referenced by xml_processor::parse(), dtd_processor::parseAttDef(), dtd_processor::parseAttrEnumeration(), xml_processor::parseAttributes(), parseAttributeValue(), dtd_processor::parseAttrList(), xml_processor::parseCharData(), dtd_processor::parseContentSpec(), dtd_processor::parseDefaultDecl(), xml_processor::parseDocTypeDecl(), xml_processor::parseElement(), dtd_processor::parseElement(), dtd_processor::parseEntity(), dtd_processor::parseEntityDef(), parseExternalID(), xml_processor::parseGeneralReference(), dtd_processor::parseIgnore(), xml_processor::parseMisc(), dtd_processor::parseMixed(), dtd_processor::parseNotation(), dtd_processor::parsePEReference(), parsePI(), xml_processor::parseProlog(), and dtd_processor::parseSubSet().
xml_forceinline void byte_manager::push |
( |
ub1_t |
x |
) |
[protected] |
xml_forceinline void byte_manager::push |
( |
const ub1_t * |
x, |
|
|
size_t |
len | |
|
) |
| | [protected] |
xml_forceinline void byte_manager::throw_exception |
( |
const char * |
msg_text |
) |
[protected] |
throws exception, adding line and char position info
- Parameters:
-
Definition at line 88 of file mngxml.hpp.
References _stream, and byte_source::throw_exception().
Referenced by xml_processor::_parseCharData(), dtd_processor::convert_ctype(), dtd_processor::expandPEReference(), xml_processor::parse(), dtd_processor::parseAttDef(), xml_processor::parseAttributes(), dtd_processor::parseAttrList(), xml_processor::parseCDATA(), parseCharRef(), dtd_processor::parseChildren(), parseComment(), xml_processor::parseContent(), dtd_processor::parseContentSpec(), dtd_processor::parseDefaultDecl(), xml_processor::parseDocTypeDecl(), xml_processor::parseDocument(), xml_processor::parseEndTag(), dtd_processor::parseEntityDef(), parseExternalID(), dtd_processor::parseIgnore(), xml_processor::parseMisc(), dtd_processor::parseMixed(), parsePI(), parseQuotedValue(), xml_processor::parseStartTag(), dtd_processor::parseSubSet(), and resolveEntity().
xml_forceinline void byte_manager::skip_string |
( |
const char * |
x, |
|
|
const char * |
message | |
|
) |
| | [protected] |
skips specified string if not found throw exception
- Parameters:
-
x |
string to skip |
message |
error message |
Definition at line 95 of file mngxml.hpp.
References _stream, and byte_source::skip_string().
Referenced by dtd_processor::parseAttDef(), dtd_processor::parseAttrList(), xml_processor::parseCDATA(), dtd_processor::parseContentSpec(), dtd_processor::parseDefaultDecl(), xml_processor::parseDocTypeDecl(), dtd_processor::parseElement(), dtd_processor::parseEntity(), dtd_processor::parseEntityDef(), parseExternalID(), dtd_processor::parseIgnore(), dtd_processor::parseInclude(), and dtd_processor::parseNotation().
xml_forceinline void byte_manager::skip_sign |
( |
ub1_t |
symbol, |
|
|
bool |
skip_before, |
|
|
bool |
skip_after, |
|
|
const char * |
message | |
|
) |
| | [protected] |
skips symbol with optional white spaces around it
- Parameters:
-
symbol |
symbol to skip |
skip_before |
before white spaces flag |
skip_after |
after white spaces flag |
message |
error message |
Definition at line 102 of file mngxml.hpp.
References _stream, and byte_source::skip_sign().
Referenced by dtd_processor::expandPEReference(), dtd_processor::parseAttrEnumeration(), parseAttributeValue(), xml_processor::parseCDATA(), parseCharRef(), parseComment(), xml_processor::parseDocTypeDecl(), dtd_processor::parseElement(), xml_processor::parseEndTag(), dtd_processor::parseEntity(), dtd_processor::parseEntityDef(), dtd_processor::parseIgnore(), dtd_processor::parseInclude(), dtd_processor::parseMixed(), dtd_processor::parseNotation(), parsePI(), xml_processor::parseStartTag(), dtd_processor::parseSubSet(), and resolveEntity().
xml_forceinline ub1_t byte_manager::skip_quote |
( |
ub1_t |
symbol = 0 |
) |
[protected] |
const char * byte_manager::parseQuotedValue |
( |
bool |
resolve_entities, |
|
|
bool |
normalize, |
|
|
bool(*)(ub1_t) |
fn, |
|
|
const char * |
message | |
|
) |
| | [protected] |
parses value wrapped with quoted symbols like '"' | "'" name '"' | "'"
- Parameters:
-
resolve_entities |
flag to resolve found entities |
normalize |
flag to normalized value |
fn |
optional function pointer to check symbol validity |
message |
error message |
Definition at line 220 of file mngxml.cpp.
References _stream, _tmp_store2, _tmp_store3, ch_ampersand, ch_cr, ch_hor_tab, ch_lf, ch_space, paged_buffer::persist(), pick(), pop(), push(), paged_buffer::reset(), reset_all_tmp(), resolveEntity(), byte_source::skip_quote(), and throw_exception().
Referenced by parseAttributeValue(), dtd_processor::parseDefaultDecl(), and parseExternalID().
xml_forceinline const char * byte_manager::parseName |
( |
|
) |
[protected] |
parses xml valid name
Definition at line 118 of file mngxml.hpp.
References _stream, _tmp_store1, is_name_char(), is_name_first_char(), paged_buffer::persist(), pick(), pop(), paged_buffer::reset(), and byte_source::throw_exception().
Referenced by dtd_processor::expandPEReference(), dtd_processor::parseAttDef(), parseAttributeValue(), dtd_processor::parseAttrList(), dtd_processor::parseChildren(), xml_processor::parseDocTypeDecl(), dtd_processor::parseElement(), xml_processor::parseEndTag(), dtd_processor::parseEntity(), dtd_processor::parseEntityDef(), dtd_processor::parseMixed(), dtd_processor::parseNotation(), parsePI(), xml_processor::parseStartTag(), and resolveEntity().
const char * byte_manager::parseValue |
( |
|
) |
[protected] |
void byte_manager::parseAttributeValue |
( |
string_t & |
name, |
|
|
string_t & |
value | |
|
) |
| | [protected] |
void byte_manager::parseComment |
( |
|
) |
[protected] |
parses comment [15] Comment ::= ''
Definition at line 130 of file mngxml.cpp.
References _doc, _tmp_store1, xml_document::add_comment(), ch_close_angle, ch_dash, paged_buffer::persist(), pick(), pop(), paged_buffer::reset(), skip_sign(), and throw_exception().
Referenced by xml_processor::parseContent(), xml_processor::parseMisc(), xml_processor::parseProlog(), and dtd_processor::parseSubSet().
void byte_manager::parseExternalID |
( |
string_t & |
value_system, |
|
|
string_t & |
value_public, |
|
|
bool |
public_strick | |
|
) |
| | [protected] |
parses external ID [75] ExternalID ::= 'SYSTEM' S SystemLiteral | 'PUBLIC' S PubidLiteral S SystemLiteral [76] NDataDecl ::= S 'NDATA' S Name
- Parameters:
-
value_system |
[out] system value |
value_public |
[out] public value |
public_strick |
force to find the public value |
Definition at line 306 of file mngxml.cpp.
References ch_close_angle, ch_P, ch_S, is_public_char(), parseQuotedValue(), pick(), skip_string(), skip_white_space(), str_PUBLIC, str_SYSTEM, and throw_exception().
Referenced by xml_processor::parseDocTypeDecl(), dtd_processor::parseEntityDef(), and dtd_processor::parseNotation().
void byte_manager::parsePI |
( |
|
) |
[protected] |
parses processing instruction
[16] PI ::= '<?' PITarget (S (Char* - (Char* '?>' Char*)))? '?>' [17] PITarget ::= Name - (('X' | 'x') ('M' | 'm') ('L' | 'l'))
Definition at line 345 of file mngxml.cpp.
References _doc, _tmp_store2, xml_document::add_pi(), ch_close_angle, ch_question, is_white_space(), os_minus_one, parseName(), paged_buffer::persist(), pick(), pop(), paged_buffer::reset(), skip_sign(), skip_white_space(), str_xml, str_template::strnocasecmp(), and throw_exception().
Referenced by xml_processor::parseContent(), xml_processor::parseMisc(), xml_processor::parseProlog(), and dtd_processor::parseSubSet().
void byte_manager::parseCharRef |
( |
paged_buffer & |
buffer |
) |
[protected] |
parses xml valid char &#[0-9]+ | &x[0-9;a-F]+
- Parameters:
-
Definition at line 179 of file mngxml.cpp.
References paged_buffer::append(), ch_0, ch_9, ch_a, ch_A, ch_f, ch_F, ch_pound, ch_semicolon, ch_X, ch_x, pick(), pop(), RADIX10, RADIX16, skip_sign(), throw_exception(), and usascii_to_utf8().
Referenced by dtd_processor::parseEntityDef(), and resolveEntity().
bool byte_manager::resolveEntity |
( |
paged_buffer & |
buffer |
) |
[protected] |
resolves entity
- Parameters:
-
Definition at line 385 of file mngxml.cpp.
References _big_pool, _doc, _entity_allocator, _entity_map, entityDecl::_is_encoded_char, entityDecl::_is_in_subset, entityDecl::_is_unparsed, entityDecl::_notation, _small_pool, _stream, entityDecl::_systemId, entityDecl::_value, ch_pound, ch_semicolon, byte_source::current_pos(), base_map< K, T, Pr, M >::end(), base_map< K, T, Pr, M >::find(), xml_grammar::find_entity_decl(), byte_source::get_location(), get_standalone(), _map< K, T, A, Pr, M >::insert(), base_string< T >::length(), buffer_loader::load(), parseCharRef(), parseName(), pick(), pop(), paged_buffer::reset(), skip_sign(), and throw_exception().
Referenced by xml_processor::_parseCharData(), xml_processor::parseGeneralReference(), and parseQuotedValue().
bool byte_manager::get_subset |
( |
|
) |
const [inline, protected] |
size_t byte_manager::get_standalone |
( |
|
) |
const [inline, protected] |
size_t byte_manager::get_version |
( |
|
) |
const [inline, protected] |
xml_forceinline void byte_manager::reset_all_tmp |
( |
bool |
reset_allocator = false |
) |
[protected] |
resets internal temporary allocator and buffers
NB!!! we don't care about encoding, because stream is responsible for recognizing encoding and converting data to the UTF-8 - Parameters:
-
reset_allocator |
flag to reset temporary allocator as well |
Definition at line 161 of file mngxml.hpp.
References _tmp_allocator, _tmp_store1, _tmp_store2, _tmp_store3, byte_allocator::reset(), and paged_buffer::reset().
Referenced by xml_processor::_parseCharData(), xml_processor::parseContent(), xml_processor::parseElement(), dtd_processor::parseEntityDef(), xml_processor::parseMisc(), xml_processor::parseProlog(), parseQuotedValue(), and dtd_processor::parseSubSet().
Member Data Documentation
document that will hold the xml and grammar
Reimplemented in xml_processor.
Definition at line 200 of file mngxml.h.
Referenced by dtd_processor::checkRepeation(), dtd_processor::expandPEReference(), dtd_processor::parse(), dtd_processor::parseAttDef(), dtd_processor::parseAttrEnumeration(), dtd_processor::parseAttrList(), dtd_processor::parseChildren(), parseComment(), dtd_processor::parseElement(), dtd_processor::parseEntity(), dtd_processor::parseMixed(), dtd_processor::parseNotation(), parsePI(), dtd_processor::parseSubSet(), and resolveEntity().
stream of bytes as input xml
Definition at line 201 of file mngxml.h.
Referenced by dtd_processor::expandPEReference(), get_standalone(), get_subset(), get_version(), xml_processor::parseDTD(), parseName(), parseQuotedValue(), pick(), pip(), pop(), push(), resolveEntity(), skip_quote(), skip_sign(), skip_string(), skip_white_space(), xml_processor::skipDTD(), and throw_exception().
The documentation for this class was generated from the following files:
|
|