textwolf  0.2
Public Member Functions | List of all members
textwolf::XmlHdrParser Class Reference

Class for parsing the header to get the character set encoding. More...

#include <xmlhdrparser.hpp>

Inheritance diagram for textwolf::XmlHdrParser:
textwolf::throws_exception

Public Member Functions

 XmlHdrParser ()
 Constructor. More...
 
 XmlHdrParser (const XmlHdrParser &o)
 Copy constructor. More...
 
void putInput (const char *src_, std::size_t srcsize_)
 Add another input chunk to process. More...
 
const std::string & consumedData () const
 Get the whole original data added with subsequent calls of putInput(const char*,std::size_t) More...
 
bool parse ()
 Call the first/next iteration of parsing the header. More...
 
const char * lasterror () const
 Get the last error occurred. More...
 
const char * encoding () const
 Get the encoding specified as attribute in the header. More...
 
std::size_t charsConsumed () const
 Get the number of ASCII characters consumed. More...
 
void clear ()
 Clear the data, reset the state. More...
 

Additional Inherited Members

- Public Types inherited from textwolf::throws_exception
enum  Cause {
  Unknown, DimOutOfRange, StateNumbersNotAscending, InvalidParamState,
  InvalidParamChar, DuplicateStateTransition, InvalidState, IllegalParam,
  IllegalAttributeName, OutOfMem, ArrayBoundsReadWrite, NotAllowedOperation,
  FileReadError, IllegalXmlHeader, InvalidTagOffset, CorruptTagStack,
  CodePageIndexNotSupported
}
 Enumeration of error cases. More...
 

Detailed Description

Class for parsing the header to get the character set encoding.

Remarks
Works with all single byte or multibyte character sets with ASCII as base

Constructor & Destructor Documentation

textwolf::XmlHdrParser::XmlHdrParser ( )
inline

Constructor.

textwolf::XmlHdrParser::XmlHdrParser ( const XmlHdrParser o)
inline

Copy constructor.

param[in] o object to copy

Member Function Documentation

std::size_t textwolf::XmlHdrParser::charsConsumed ( ) const
inline

Get the number of ASCII characters consumed.

Returns
the number of characters
void textwolf::XmlHdrParser::clear ( )
inline

Clear the data, reset the state.

const std::string& textwolf::XmlHdrParser::consumedData ( ) const
inline

Get the whole original data added with subsequent calls of putInput(const char*,std::size_t)

Returns
the data block as string reference
const char* textwolf::XmlHdrParser::encoding ( ) const
inline

Get the encoding specified as attribute in the header.

Returns
the encoding or NULL if not specified or not encountered yet in the source parsed
const char* textwolf::XmlHdrParser::lasterror ( ) const
inline

Get the last error occurred.

Returns
the pointer to the last error or NULL if no error occurred
bool textwolf::XmlHdrParser::parse ( )
inline

Call the first/next iteration of parsing the header.

Returns
true on success, false if more data is needed (putInput(const char*,std::size_t)) or if an error occurred. Check lasterror() for an error
void textwolf::XmlHdrParser::putInput ( const char *  src_,
std::size_t  srcsize_ 
)
inline

Add another input chunk to process.

Parameters
[in]src_pointer to chunk
[in]srcsize_size of chunk in bytes

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