|
Home / Open source / Terimber 2.0
byte_source Class Referencebase that does all the work except getting bytes from stream
More...
#include <storexml.h>
List of all members.
|
Public Member Functions |
| | byte_source (mem_pool_t &small_pool, mem_pool_t &big_pool, size_t xml_size, const char *url, bool subset) |
| | constructor
|
| virtual | ~byte_source () |
| | destructor
|
| xml_forceinline ub1_t | pick () |
| | picks byte
|
| xml_forceinline ub1_t | pop () |
| | pops byte operator++(int)
|
| xml_forceinline ub1_t | pip () |
| | pips byte operator++()
|
| xml_forceinline void | skip_white_space (bool mustPresent=false, const char *message=0) |
| | skips junk chars defined by is_white_space() function if not then throw exception with specified message
|
| void | throw_exception (const char *msg_text) |
| | throws exception adding line and char postion information
|
| void | skip_string (const char *x, const char *message) |
| | skips string if not, then throws exception with specified message
|
| void | skip_sign (ub1_t symbol, bool skip_before, bool skip_after, const char *message) |
| | skips one byte if not, then throws exception with specified message
|
| ub1_t | skip_quote (ub1_t symbol=0) |
| | skips quote symbol it can be single quote or double quote if input parameter = 0 then function detects the type of quote and returns the detected quote symbol if input parameter = quote symbol function skip the specified quote symbol in case of problems function throws exception
|
| size_t | current_pos () const |
| | returns current char position
|
| void | push (const ub1_t *x, size_t len) |
| | inserts into head of sequence
|
| void | push (ub1_t x) |
| | pushes byte back to buffer head
|
| size_t | pull (ub1_t *x, size_t len) |
| | pulls block of bytes from stream
|
| encodingSchema | get_encoding () const |
| | returns detected encoding schema
|
| void | set_encoding (encodingSchema schema) |
| | sets encoding
|
| const char * | get_location () const |
| | gets stream location
|
| size_t | get_standalone () const |
| | gets standalone flag
|
| bool | get_subset () const |
| | gets subset flag
|
| size_t | get_version () const |
| | gets version
|
| size_t | get_xml_size () const |
| | xml size
|
Protected Member Functions |
| virtual bool | data_request (ub1_t *buf, size_t &len)=0 |
| | pure virtual function getting bytes from stream
|
| encodingSchema | parseXMLDecl () |
| | parses xml declaration [23] XMLDecl ::= '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>'
|
| encodingSchema | parseTextDecl () |
| | parses text declaration [77] TextDecl ::= '<?xml' VersionInfo? EncodingDecl S? '?>'
|
| size_t | get_buffer_pos () const |
| | gets buffer position
|
| void | reset_buffer () |
| | resets internal buffer
|
Protected Attributes |
| byte_allocator * | _depot_allocator |
| | depot allocator
|
| byte_allocator * | _convert_allocator |
| | conversion allocator
|
| byte_allocator * | _store_allocator |
| | temporary store allocator
|
| byte_allocator * | _list_allocator |
| | store buffers allocator
|
| mem_pool_t & | _small_pool |
| | small memory pool
|
| mem_pool_t & | _big_pool |
| | big memory pool
|
| const size_t | _xml_size |
| | xml size
|
| string_t | _url |
| | the location of xml stream
|
Private Member Functions |
| bool | convert_chars (size_t count) |
| | converts count bytes from stream to internal buffer
|
| bool | taste_buffer () |
| | checks the encoding
|
| bool | auto_convert () |
| | does auto conversion
|
| ub1_t | go_shopping () |
| | gets bytes from stream
|
| bool | parseXMLDeclInfo () |
| | parses xml declaration info
|
| void | parseVersion () |
| | parses version
|
| encodingSchema | parseEncoding () |
| | parses encoding
|
| size_t | parseStandalone () |
| | parses standalone info
|
| encodingSchema | checkEncodingSchema (const char *schema) |
| | validates the specified schema
|
| void | scanQuotedValue (ub1_t *value, size_t len, bool(*fn)(ub1_t), const char *message) |
| | scans the quoted value to make sure it is valid
|
Private Attributes |
| bool | _subset |
| | subset flag
|
| ub1_t * | _buffer |
| | current buffer
|
| ub1_t * | _convert_buffer |
| | convert buffer
|
| size_t | _buffer_pos |
| | current buffer position
|
| ub1_t | _symbol |
| | current symbol
|
| store_list_t | _active_store |
| | store buffers in use
|
| store_list_t | _used_store |
| | store buffers for reusing
|
| size_t | _line_counter |
| | line number
|
| size_t | _char_counter |
| | char position (for multibyte chars)
|
| size_t | _pos_counter |
| | byte position
|
| encodingSchema | _encodingSchema |
| | encoding schema
|
| size_t | _version |
| | version
|
| size_t | _standalone |
| | standalone flag
|
| bool | _end |
| | end of stream flag
|
Detailed Description
base that does all the work except getting bytes from stream
Definition at line 45 of file storexml.h.
Constructor & Destructor Documentation
| byte_source::byte_source |
( |
mem_pool_t & |
small_pool, |
|
|
mem_pool_t & |
big_pool, |
|
|
size_t |
xml_size, |
|
|
const char * |
url, |
|
|
bool |
subset | |
|
) |
| | |
constructor
- Parameters:
-
| small_pool |
small memory pool |
| big_pool |
big memory pool |
| xml_size |
xml size - just a tip |
| url |
optional location |
| subset |
subset flag |
Definition at line 46 of file storexml.cpp.
References _big_pool, _buffer, _convert_allocator, _convert_buffer, _depot_allocator, _list_allocator, _small_pool, _store_allocator, _xml_size, byte_allocator::allocate(), pool< C >::loan_object(), and os_def_size.
| byte_source::~byte_source |
( |
|
) |
[virtual] |
Member Function Documentation
| xml_forceinline ub1_t byte_source::pick |
( |
|
) |
|
picks byte
Definition at line 67 of file storexml.hpp.
References _buffer_pos, _symbol, _xml_size, and go_shopping().
Referenced by parseTextDecl(), parseXMLDecl(), byte_manager::pick(), pip(), scanQuotedValue(), skip_quote(), skip_string(), and skip_white_space().
| xml_forceinline ub1_t byte_source::pop |
( |
|
) |
|
pops byte operator++(int)
Definition at line 75 of file storexml.hpp.
References _buffer, _buffer_pos, _char_counter, _line_counter, _pos_counter, _symbol, _xml_size, ch_cr, ch_lf, and go_shopping().
Referenced by parseTextDecl(), parseXMLDecl(), pip(), byte_manager::pop(), scanQuotedValue(), skip_quote(), skip_string(), and skip_white_space().
| xml_forceinline ub1_t byte_source::pip |
( |
|
) |
|
| xml_forceinline void byte_source::skip_white_space |
( |
bool |
mustPresent = false, |
|
|
const char * |
message = 0 | |
|
) |
| | |
| void byte_source::throw_exception |
( |
const char * |
msg_text |
) |
|
throws exception adding line and char postion information
- Parameters:
-
Definition at line 116 of file storexml.cpp.
References _char_counter, _line_counter, exception::_throw(), base_string< T >::append(), str_template::strlen(), and str_template::strprint().
Referenced by convert_chars(), parseEncoding(), byte_manager::parseName(), parseStandalone(), parseTextDecl(), parseVersion(), parseXMLDecl(), parseXMLDeclInfo(), push(), scanQuotedValue(), skip_quote(), skip_sign(), skip_string(), skip_white_space(), taste_buffer(), and byte_manager::throw_exception().
| void byte_source::skip_string |
( |
const char * |
x, |
|
|
const char * |
message | |
|
) |
| | |
| void byte_source::skip_sign |
( |
ub1_t |
symbol, |
|
|
bool |
skip_before, |
|
|
bool |
skip_after, |
|
|
const char * |
message | |
|
) |
| | |
| ub1_t byte_source::skip_quote |
( |
ub1_t |
symbol = 0 |
) |
|
| xml_forceinline size_t byte_source::current_pos |
( |
|
) |
const [inline] |
| void byte_source::push |
( |
const ub1_t * |
x, |
|
|
size_t |
len | |
|
) |
| | |
inserts into head of sequence
- Parameters:
-
| x |
buffer |
| len |
buffer length |
Definition at line 134 of file storexml.cpp.
References _active_store, _buffer, _buffer_pos, _list_allocator, _pos_counter, _store_allocator, _symbol, _used_store, _xml_size, byte_allocator::allocate(), base_list< T >::empty(), base_list< T >::front(), _list< T, A >::pop_front(), _list< T, A >::push_front(), and throw_exception().
Referenced by push(), and byte_manager::push().
| xml_forceinline void byte_source::push |
( |
ub1_t |
x |
) |
[inline] |
pushes byte back to buffer head
- Parameters:
-
Definition at line 136 of file storexml.hpp.
References push().
| size_t byte_source::pull |
( |
ub1_t * |
x, |
|
|
size_t |
len | |
|
) |
| | |
| const char * byte_source::get_location |
( |
|
) |
const [inline] |
| virtual bool byte_source::data_request |
( |
ub1_t * |
buf, |
|
|
size_t & |
len | |
|
) |
| | [protected, pure virtual] |
parses xml declaration [23] XMLDecl ::= '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>'
Definition at line 841 of file storexml.cpp.
References _encodingSchema, _standalone, _version, AUTO, ch_close_angle, ch_e, ch_question, ch_s, ch_v, parseEncoding(), parseStandalone(), parseVersion(), pick(), pop(), skip_white_space(), and throw_exception().
Referenced by parseXMLDeclInfo().
parses text declaration [77] TextDecl ::= '<?xml' VersionInfo? EncodingDecl S? '?>'
Definition at line 891 of file storexml.cpp.
References _encodingSchema, _version, ch_close_angle, ch_e, ch_question, ch_v, parseEncoding(), parseVersion(), pick(), pop(), skip_white_space(), and throw_exception().
Referenced by parseXMLDeclInfo().
| bool byte_source::convert_chars |
( |
size_t |
count |
) |
[private] |
converts count bytes from stream to internal buffer
Definition at line 532 of file storexml.cpp.
References _buffer, _buffer_pos, _convert_buffer, _encodingSchema, _symbol, _xml_size, base_string< T >::append(), data_request(), fixedN_to_utf8(), isoN_to_utf8(), throw_exception(), UCS_4B, UCS_4BS, UCS_4L, UCS_4LS, US_ASCII, utf8_to_utf8(), UTF_16B, UTF_16L, UTF_8, UTF_ISO88591, WINDOWS_1251, and windowsN_to_utf8().
Referenced by auto_convert(), parseXMLDeclInfo(), and taste_buffer().
| bool byte_source::taste_buffer |
( |
|
) |
[private] |
checks the encoding
Definition at line 251 of file storexml.cpp.
References _buffer, _buffer_pos, _convert_buffer, _encodingSchema, _symbol, convert_chars(), data_request(), fixedN_to_utf8(), parseXMLDeclInfo(), throw_exception(), UCS4BBOM, UCS4BPre, UCS4LBOM, UCS4LPre, UCS_4B, UCS_4L, UTF16BBOM, UTF16BPre, UTF16LBOM, UTF16LPre, utf8_to_utf8(), UTF8BOM, UTF8Pre, UTF_16B, UTF_16L, and UTF_8.
Referenced by go_shopping().
| bool byte_source::auto_convert |
( |
|
) |
[private] |
| ub1_t byte_source::go_shopping |
( |
|
) |
[private] |
gets bytes from stream
Definition at line 202 of file storexml.cpp.
References _active_store, _buffer, _buffer_pos, _encodingSchema, _end, _list_allocator, _symbol, _used_store, _xml_size, AUTO, auto_convert(), base_list< T >::empty(), base_list< T >::front(), _list< T, A >::pop_front(), _list< T, A >::push_front(), and taste_buffer().
Referenced by pick(), pop(), and pull().
| bool byte_source::parseXMLDeclInfo |
( |
|
) |
[private] |
parses xml declaration info
Definition at line 468 of file storexml.cpp.
References _big_pool, _buffer, _buffer_pos, _encodingSchema, _small_pool, _standalone, _subset, _version, _xml_size, AUTO, auto_convert(), ch_close_angle, ch_question, convert_chars(), get_encoding(), get_standalone(), get_version(), parseTextDecl(), parseXMLDecl(), set_encoding(), throw_exception(), UCS_4, UCS_4B, UCS_4BS, UCS_4L, UCS_4LS, UTF_16, UTF_16B, UTF_16L, and UTF_8.
Referenced by taste_buffer().
| void byte_source::parseVersion |
( |
|
) |
[private] |
parses version
Definition at line 782 of file storexml.cpp.
References _convert_buffer, _version, ch_equal, is_versionnum_char(), os_minus_one, scanQuotedValue(), skip_sign(), skip_string(), str_version, str_template::strnocasecmp(), throw_exception(), and xml_decl_max_len.
Referenced by parseTextDecl(), and parseXMLDecl().
parses encoding
Definition at line 800 of file storexml.cpp.
References _convert_buffer, ch_equal, checkEncodingSchema(), is_encname_char(), is_letter(), scanQuotedValue(), skip_sign(), skip_string(), str_encoding, throw_exception(), and xml_decl_max_len.
Referenced by parseTextDecl(), and parseXMLDecl().
| size_t byte_source::parseStandalone |
( |
|
) |
[private] |
parses standalone info
Definition at line 820 of file storexml.cpp.
References _convert_buffer, ch_equal, os_minus_one, scanQuotedValue(), skip_sign(), skip_string(), str_no, str_standalone, str_yes, str_template::strcmp(), throw_exception(), and xml_decl_max_len.
Referenced by parseXMLDecl().
| encodingSchema byte_source::checkEncodingSchema |
( |
const char * |
schema |
) |
[private] |
validates the specified schema
- Parameters:
-
Definition at line 949 of file storexml.cpp.
References AUTO, os_minus_one, str_template::strnocasecmp(), UCS_4, UCS_4B, UCS_4L, US_ASCII, UTF_16, UTF_16B, UTF_16L, UTF_8, UTF_ISO88591, and WINDOWS_1251.
Referenced by parseEncoding().
| void byte_source::scanQuotedValue |
( |
ub1_t * |
value, |
|
|
size_t |
len, |
|
|
bool(*)(ub1_t) |
fn, |
|
|
const char * |
message | |
|
) |
| | [private] |
| BEGIN_TERIMBER_NAMESPACE size_t byte_source::get_standalone |
( |
|
) |
const [inline] |
| bool byte_source::get_subset |
( |
|
) |
const [inline] |
| size_t byte_source::get_version |
( |
|
) |
const [inline] |
| size_t byte_source::get_xml_size |
( |
|
) |
const [inline] |
| size_t byte_source::get_buffer_pos |
( |
|
) |
const [inline, protected] |
| void byte_source::reset_buffer |
( |
|
) |
[protected] |
resets internal buffer
Definition at line 97 of file storexml.cpp.
References _active_store, _buffer_pos, _char_counter, _encodingSchema, _end, _line_counter, _list_allocator, _pos_counter, _standalone, _store_allocator, _symbol, _used_store, _version, _xml_size, AUTO, base_list< T >::clear(), os_minus_one, and byte_allocator::reset().
Member Data Documentation
xml size
Definition at line 223 of file storexml.h.
Referenced by auto_convert(), byte_source(), convert_chars(), get_xml_size(), go_shopping(), parseXMLDeclInfo(), pick(), pop(), pull(), push(), reset_buffer(), and ~byte_source().
The documentation for this class was generated from the following files:
|
|