Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

XmlSimpleModel Class Reference

A simple XML modeling class. More...

#include <xmlsimplemodel.h>

Inheritance diagram for XmlSimpleModel:

XmlModelBase UserOfTextCodec UserOfFunnelDevice List of all members.

Public Methods

 XmlSimpleModel (void)
 A constructor. More...

virtual ~XmlSimpleModel (void)
 A destructor. More...

virtual bool manageEvent (XmlModelEvent *event)
 Manage XML events. More...

virtual void setGrammar (GrammarBase *gr)
 Set a grammar for the model. More...

virtual void setSAXEmitter (SAXEmitter *emitter, void *data=0)
 Set SAX emitter for decoding. More...

virtual void receiveData (XmlChar *data, size_t size)
 Receive data from another object. More...


Protected Attributes

GrammarBasegrammar
 The grammar used for compression.

bool inCDATA
 Indication of CDATA section.

bool inDoctype
 Indication of DOCTYPE section.

bool elementHasAttributes
 Indication whether current element has any attributes.

bool attributeListComplete
 Flag whether all the attributes have been decoded.

StructuralSymbols::Symbol state
 State of the model. More...

ElementIdselementIds
 Hashtable of element ids.

SimpleElementTableelements
 Hashtable of element contexts.

ElementNamesListelementNamesList
 List of element names.

unsigned long elementCounter
 Counter for unique element numbering.

Stack< unsigned long > * elementStack
 Stack of element ids. More...

XmlChar * buffer
 Buffer for read data. More...

size_t bufferLength
 Length of the data in the buffer.

size_t fibBits
 Number of read bits of Fibonacci code. More...

unsigned long fibCode
 Read Fibonacci code. More...

bool fibLastWasOne
 Helper variable for decoding Fibonacci codes.

DataQueuedataQueue
 The queue of decoded data items (such as names of the attributes, etc.).

SAXEmittersaxEmitter
 Pointer to the SAX emitter. More...

void * userData
 User data for SAX emitter. More...


Detailed Description

A simple XML modeling class.

This class implements a simple model for compression and decompression of XML data.

Definition at line 147 of file xmlsimplemodel.h.


Constructor & Destructor Documentation

XmlSimpleModel::XmlSimpleModel void   
 

A constructor.

Initialization is performed.

Definition at line 207 of file xmlsimplemodel.cpp.

References attributeListComplete, buffer, bufferLength, dataQueue, elementCounter, elementHasAttributes, elementIds, elementNamesList, elements, elementStack, fibBits, fibCode, fibLastWasOne, grammar, inCDATA, inDoctype, NEW, saxEmitter, Collection< XmlChar >::setAutoDelete, HashTable< unsigned long, SimpleElementContext, List, 3079 >::setAutoDelete, HashTable< XmlChar *, unsigned long, List, 3079 >::setAutoDelete, Collection< unsigned >::setAutoDelete, Collection< DataQueueItem >::setAutoDelete, state, and userData.

XmlSimpleModel::~XmlSimpleModel void    [virtual]
 

A destructor.

The resources occupied by the model are freed.

Definition at line 258 of file xmlsimplemodel.cpp.

References Collection< XmlChar >::count, dataQueue, DELETE, elementNamesList, elements, elementStack, ExaltOptions::getOption, OUTPUTEENDLINE, OUTPUTENL, ExaltOptions::Verbose, and ExaltOptions::Yes.


Member Function Documentation

bool XmlSimpleModel::manageEvent XmlModelEvent   event [virtual]
 

Manage XML events.

This methods implements the encoding procedure. The model accepts the XML events here and writes the (transformed) data to the underlying grammar.

Parameters:
event  The XML event.

Implements XmlModelBase.

Definition at line 297 of file xmlsimplemodel.cpp.

References List< XmlChar >::append, GrammarBase::append, APPEND_ALL_DATA, APPEND_ALL_DATA_LENGTH, APPEND_BUFFER_DATA, XmlStartElementEvent::attr, XmlModelEvent::Characters, CHECK_POINTER, XmlModelEvent::Comment, UserOfTextCodec::createDefaultTextCodec, XmlPIEvent::data, XmlCommentEvent::data, XmlDefaultEvent::data, XmlCharactersEvent::data, XmlModelEvent::Default, DELETE, XmlStartDoctypeEvent::doctypeName, elementCounter, elementIds, elementNamesList, elements, elementStack, Fibonacci::encodeToBuffer, XmlDeclEvent::encoding, XmlModelEvent::EndCDATA, XmlModelEvent::EndDoctype, XmlModelEvent::EndElement, XmlModelEvent::EntityDecl, XmlEntityDeclEvent::entityName, FATAL, HashTable< unsigned long, SimpleElementContext, List, 3079 >::find, HashTable< XmlChar *, unsigned long, List, 3079 >::find, TextCodec::getMIB, grammar, XmlStartDoctypeEvent::hasInternalSubset, HashTable< unsigned long, SimpleElementContext, List, 3079 >::insert, HashTable< XmlChar *, unsigned long, List, 3079 >::insert, XmlEntityDeclEvent::isParameterEntity, XmlDefaultEvent::length, XmlCharactersEvent::length, XmlEndElementEvent::name, XmlStartElementEvent::name, SimpleElementContext::name, NEW, XmlModelEvent::NotationDecl, XmlNotationDeclEvent::notationName, XmlEntityDeclEvent::notationName, XmlModelEvent::PI, Stack< unsigned long >::pop, XmlNotationDeclEvent::publicId, XmlEntityDeclEvent::publicId, XmlStartDoctypeEvent::publicId, Stack< unsigned long >::push, GrammarBase::setAlphabetBaseSize, XmlDeclEvent::standalone, XmlModelEvent::StartCDATA, XmlModelEvent::StartDoctype, XmlModelEvent::StartElement, TextCodec::suggestAlphabetBaseSize, XmlNotationDeclEvent::systemId, XmlEntityDeclEvent::systemId, XmlStartDoctypeEvent::systemId, XmlPIEvent::target, UserOfTextCodec::textCodec, XmlModelEvent::type, XmlEntityDeclEvent::value, XmlEntityDeclEvent::valueLength, XmlDeclEvent::version, WRN, XmlChar, xmlchar_strcpy, xmlchar_strlen, and XmlModelEvent::XmlDecl.

void XmlSimpleModel::receiveData XmlChar *    data,
size_t    size
[virtual]
 

Receive data from another object.

This method implements the decoding procedure. It receives data from the underlying grammar and reconstructs the XML data.

Parameters:
data  The data coming from the grammar.
size  The length of the data.

Implements XmlModelBase.

Definition at line 835 of file xmlsimplemodel.cpp.

References List< XmlChar >::append, attributeListComplete, buffer, bufferLength, CHANGE_STATE, CHECK_POINTER, Collection< DataQueueItem >::count, DataQueueItem::data, dataQueue, Fibonacci::decode, DELETE, Queue< DataQueueItem >::dequeue, elementCounter, elementHasAttributes, elementNamesList, elements, elementStack, Queue< DataQueueItem >::enqueue, fibBits, fibCode, fibLastWasOne, HashTable< unsigned long, SimpleElementContext, List, 3079 >::find, FINISH_ELEMENT_START, inCDATA, inDoctype, HashTable< unsigned long, SimpleElementContext, List, 3079 >::insert, SimpleElementContext::name, NEW, Stack< unsigned long >::pop, RESET_BUFFER, RESET_STATE, SAFE_CALL_EMITTER, state, DataQueueItem::type, userData, XML_MODEL_BUFFER_DEFAULT_SIZE, XmlChar, xmlchar_strcpy, and xmlchar_strlen.

virtual void XmlSimpleModel::setGrammar GrammarBase   gr [inline, virtual]
 

Set a grammar for the model.

Sets a grammar that is used for the compression of the data.

Parameters:
gr  The pointer to the grammar.

Implements XmlModelBase.

Definition at line 166 of file xmlsimplemodel.h.

References grammar.

void XmlSimpleModel::setSAXEmitter SAXEmitter   emitter,
void *    data = 0
[virtual]
 

Set SAX emitter for decoding.

Sets the SAX emitter and (optionaly) the user data.

Parameters:
emitter  The SAX emitter.
data  The user data structure.

Implements XmlModelBase.

Definition at line 285 of file xmlsimplemodel.cpp.

References saxEmitter, and userData.


Member Data Documentation

XmlChar* XmlSimpleModel::buffer [protected]
 

Buffer for read data.

Used during decoding.

Definition at line 223 of file xmlsimplemodel.h.

Referenced by receiveData, and XmlSimpleModel.

Stack<unsigned long>* XmlSimpleModel::elementStack [protected]
 

Stack of element ids.

Stores the "level" in the document.

Definition at line 216 of file xmlsimplemodel.h.

Referenced by manageEvent, receiveData, XmlSimpleModel, and ~XmlSimpleModel.

size_t XmlSimpleModel::fibBits [protected]
 

Number of read bits of Fibonacci code.

Used during decoding.

Definition at line 235 of file xmlsimplemodel.h.

Referenced by receiveData, and XmlSimpleModel.

unsigned long XmlSimpleModel::fibCode [protected]
 

Read Fibonacci code.

Used during decoding.

Definition at line 242 of file xmlsimplemodel.h.

Referenced by receiveData, and XmlSimpleModel.

SAXEmitter* XmlSimpleModel::saxEmitter [protected]
 

Pointer to the SAX emitter.

Used during decoding.

Definition at line 255 of file xmlsimplemodel.h.

Referenced by setSAXEmitter, and XmlSimpleModel.

StructuralSymbols::Symbol XmlSimpleModel::state [protected]
 

State of the model.

Used during decoding. State is represented by StructuralSymbols.

Definition at line 197 of file xmlsimplemodel.h.

Referenced by receiveData, and XmlSimpleModel.

void* XmlSimpleModel::userData [protected]
 

User data for SAX emitter.

Used during decoding.

Definition at line 262 of file xmlsimplemodel.h.

Referenced by receiveData, setSAXEmitter, and XmlSimpleModel.


The documentation for this class was generated from the following files:
Generated on Wed Feb 5 10:43:07 2003 for Exalt by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002