Thread portable class


Gate portable class


Timer class


Pool class


Terimber 2.0


About C++


Downloads Products & Services Support Clients Open Source About



Home / Open source / Terimber 2.0

byte_manager Class Reference

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 More...

#include <mngxml.h>

Inheritance diagram for byte_manager:

dtd_processor xml_processor

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

BEGIN_TERIMBER_NAMESPACE byte_manager::byte_manager ( byte_source stream,
xml_document doc,
mem_pool_t small_pool,
mem_pool_t big_pool,
size_t  xml_size 
) [protected]

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.


Member Function Documentation

xml_forceinline ub1_t byte_manager::pip (  )  [protected]

picks than pop like operator++()

Definition at line 60 of file mngxml.hpp.

References _stream, and byte_source::pip().

xml_forceinline void byte_manager::push ( ub1_t  x  )  [protected]

xml_forceinline void byte_manager::push ( const ub1_t x,
size_t  len 
) [protected]

pushes array of bytes back to buffer

Parameters:
x  pointer to array
len  array length

Definition at line 81 of file mngxml.hpp.

References _stream, and byte_source::push().

xml_forceinline void byte_manager::skip_string ( const char *  x,
const char *  message 
) [protected]

xml_forceinline void byte_manager::skip_sign ( ub1_t  symbol,
bool  skip_before,
bool  skip_after,
const char *  message 
) [protected]

xml_forceinline ub1_t byte_manager::skip_quote ( ub1_t  symbol = 0  )  [protected]

skips quote symbol (single or double) if input param is zero returns what type of quote has been found

Parameters:
symbol  type of quote

Definition at line 109 of file mngxml.hpp.

References _stream, and byte_source::skip_quote().

Referenced by dtd_processor::parseEntityDef().

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().

const char * byte_manager::parseValue (  )  [protected]

parses xml valid value

Definition at line 103 of file mngxml.cpp.

References _tmp_store1, is_name_char(), paged_buffer::persist(), pick(), pop(), and paged_buffer::reset().

Referenced by dtd_processor::parseAttrEnumeration().

void byte_manager::parseAttributeValue ( string_t name,
string_t value 
) [protected]

parses attribute style xml part like: name S? = S? '"' | "'" value '"' | "'" returns the name and value

Parameters:
name  [out] name
value  [out] value

Definition at line 119 of file mngxml.cpp.

References ch_equal, is_attribute_char(), parseName(), parseQuotedValue(), skip_sign(), and skip_white_space().

Referenced by xml_processor::parseAttributes().

void byte_manager::parseComment (  )  [protected]

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:
buffer  [out] buffer

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::get_subset (  )  const [inline, protected]

returns the current subset value

Definition at line 137 of file mngxml.hpp.

References _stream, and byte_source::get_subset().

Referenced by dtd_processor::parse().

size_t byte_manager::get_standalone (  )  const [inline, protected]

returns the current standalone value

Definition at line 145 of file mngxml.hpp.

References _stream, and byte_source::get_standalone().

Referenced by xml_processor::parseDocTypeDecl(), xml_processor::parseDocument(), and resolveEntity().

size_t byte_manager::get_version (  )  const [inline, protected]

returns the current version

Definition at line 153 of file mngxml.hpp.

References _stream, and byte_source::get_version().

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

const size_t byte_manager::_xml_size [protected]

xml size tip

Definition at line 189 of file mngxml.h.

Referenced by xml_processor::parseDTD(), xml_processor::skipDTD(), and ~byte_manager().

depot store #1 allocator

Definition at line 192 of file mngxml.h.

Referenced by ~byte_manager().

depot store #2 allocator

Definition at line 193 of file mngxml.h.

Referenced by ~byte_manager().

depot store #3 allocator

Definition at line 194 of file mngxml.h.

Referenced by ~byte_manager().

temporary store #1 allocator

Definition at line 196 of file mngxml.h.

Referenced by ~byte_manager().

temporary store #2 allocator

Definition at line 197 of file mngxml.h.

Referenced by ~byte_manager().

temporary store #3 allocator

Definition at line 198 of file mngxml.h.

Referenced by ~byte_manager().

entity allocator

Definition at line 199 of file mngxml.h.

Referenced by xml_processor::parse(), resolveEntity(), and ~byte_manager().

we need to keep track for recursive entities

Definition at line 202 of file mngxml.h.

Referenced by xml_processor::parse(), and resolveEntity().

there are situation while parsing when we need three temporary containars simultaniously

Definition at line 204 of file mngxml.h.

Referenced by xml_processor::_parseCharData(), xml_processor::parseCDATA(), parseComment(), xml_processor::parseGeneralReference(), parseName(), parseValue(), and reset_all_tmp().


The documentation for this class was generated from the following files:


© Copyright Terimber 2003-.