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

xmladaptivemodel.cpp File Reference

Definitions of XmlAdaptiveModel class methods. More...

#include "xmladaptivemodel.h"

Go to the source code of this file.

Defines

#define SAFE_CALL_EMITTER(_x_)
 Call SAX emitter in a safe way. More...

#define RESET_BUFFER
 Resets (empties) the input buffer. More...

#define CHANGE_STATE(_s_)
 Change the state of the model. More...

#define RESET_STATE   state = AdaptiveStructuralSymbols::None
 Set the state to None.

#define APPEND_ALL_DATA_LENGTH(_gr_, _data_, _length_, _complete_)
#define APPEND_ALL_DATA_LENGTH_CONVERT_AMP(_gr_, _data_, _length_, _complete_)
#define APPEND_ALL_DATA(_gr_, _data_, _complete_)
#define APPEND_BUFFER_DATA(_gr_, _buffer_, _nrItems_)
#define END_CHARACTER_DATA_SECTION(_gr_)
 End the character data section. More...

#define RESET_CLUE_EDGE
 Resets the clueEdge value. More...

#define INCREASE_CLUE_EDGE
 Increases the value of clueEdge. More...

#define REPORT_NACK
 Appends the NACK informations to the grammar. More...

#define REPORT_DIFFERENT_EDGE(_edge_)
 Appends data reporting a different edge to the grammar. More...

#define FINISH_START_ELEMENT_WITH_NO_ATTRIBUTES
 If the current element has no attributes, this macro emits appropriate SAX event. More...


Detailed Description

Definitions of XmlAdaptiveModel class methods.

This file contains definitions of XmlAdaptiveModel class methods.

Definition in file xmladaptivemodel.cpp.


Define Documentation

#define APPEND_ALL_DATA _gr_,
_data_,
_complete_   
 

Value:

{                                                               \
  CHECK_POINTER(_gr_);                                          \
                                                                \
  if (!_data_)                                                  \
    return false;                                               \
                                                                \
  for (int _i_ = 0; _data_[_i_]; _i_++)                         \
    _gr_->append((TerminalValue)_data_[_i_]);                   \
                                                                \
  if (_complete_)                                               \
    _gr_->append(AdaptiveStructuralSymbols::EndOfBlock);        \
}
Append the data to the right side of the root rule of the grammar. If complete is TRUE, insert also "end of chunk symbol".
Parameters:
_gr_  Grammar.
_data_  Appended data.
_complete_  Indication if the data are complete.

Definition at line 129 of file xmladaptivemodel.cpp.

Referenced by XmlSimpleModel::manageEvent, and XmlAdaptiveModel::manageEvent.

#define APPEND_ALL_DATA_LENGTH _gr_,
_data_,
_length_,
_complete_   
 

Value:

{                                                                       \
  CHECK_POINTER(_gr_);                                                  \
                                                                        \
  for (int _i_ = 0; _i_ < _length_; _i_++)                              \
    _gr_->append((TerminalValue)_data_[_i_]);                           \
                                                                        \
  if (_complete_)                                                       \
    _gr_->append(AdaptiveStructuralSymbols::EndOfBlock);                \
}
Append the data of length length to the right side of the root rule of the grammar. If complete is TRUE, insert also "end of chunk symbol".
Parameters:
_gr_  Grammar.
_data_  Appended data.
_length_  Length of the data.
_complete_  Indication if the data are complete.

Definition at line 85 of file xmladaptivemodel.cpp.

Referenced by XmlSimpleModel::manageEvent, and XmlAdaptiveModel::manageEvent.

#define APPEND_ALL_DATA_LENGTH_CONVERT_AMP _gr_,
_data_,
_length_,
_complete_   
 

Value:

{                                                                               \
  CHECK_POINTER(_gr_);                                                          \
                                                                                \
  for (int _i_ = 0; _i_ < _length_; _i_++)                                      \
    {                                                                           \
      if (_data_[_i_] == '&')                                                   \
        _gr_->append((TerminalValue)AMP_REPLACEMENT);                           \
      else                                                                      \
        _gr_->append((TerminalValue)_data_[_i_]);                               \
    }                                                                           \
                                                                                \
  if (_complete_)                                                               \
    _gr_->append(AdaptiveStructuralSymbols::EndOfBlock);                        \
}
Append the data of length length to the right side of the root rule of the grammar. If complete is TRUE, insert also "end of chunk symbol".
Parameters:
_gr_  Grammar.
_data_  Appended data.
_length_  Length of the data.
_complete_  Indication if the data are complete.

Definition at line 105 of file xmladaptivemodel.cpp.

Referenced by XmlAdaptiveModel::manageEvent.

#define APPEND_BUFFER_DATA _gr_,
_buffer_,
_nrItems_   
 

Value:

{                                                       \
  for (size_t _i_ = 0; _i_ < _nrItems_; _i_++)          \
    {                                                   \
      _gr_->append(_buffer_[_i_]);                      \
    }                                                   \
}
Append data from buffer to the right side of the root rule of the grammar.
Parameters:
_gr_  Grammar.
_buffer_  Buffer containing data.
_nrItems_  Number of items in the buffer.

Definition at line 151 of file xmladaptivemodel.cpp.

Referenced by XmlSimpleModel::manageEvent, and XmlAdaptiveModel::manageEvent.

#define CHANGE_STATE _s_   
 

Value:

{                                                                       \
  stateChanged = false;                                                 \
  if (state != AdaptiveStructuralSymbols::KnownElement &&               \
      (state == AdaptiveStructuralSymbols::None || state == _s_))       \
  {                                                                     \
    state = _s_;                                                        \
    stateChanged = true;                                                \
  }                                                                     \
}
Change the state of the model.

The state is changed only if current state is None.

Parameters:
_s_  The desired state.

Definition at line 61 of file xmladaptivemodel.cpp.

Referenced by XmlSimpleModel::receiveData, and XmlAdaptiveModel::receiveData.

#define END_CHARACTER_DATA_SECTION _gr_   
 

Value:

{                                                       \
  _gr_->append(AdaptiveStructuralSymbols::EndOfBlock);  \
  inCharacters = false;                                 \
}
End the character data section.

Appends ending zero to the grammar.

Parameters:
_gr_  The pointer to the grammar.

Definition at line 167 of file xmladaptivemodel.cpp.

Referenced by XmlAdaptiveModel::manageEvent.

#define FINISH_START_ELEMENT_WITH_NO_ATTRIBUTES
 

Value:

{                                                                               \
  if (!attrPos && !dataQueue->isEmpty())                                        \
    {                                                                           \
      DBG("FINISHING WITH NO ATTRS!");                                          \
      dataQueueItem = dataQueue->dequeue();                                     \
                                                \
      elementModelerStack.top()->modeler->setAttributes(false);                 \
                                \
      SAFE_CALL_EMITTER(startElement(userData, dataQueueItem->data, 0));        \
      attrPos = 1;                                                              \
    }                                                                           \
}
If the current element has no attributes, this macro emits appropriate SAX event.

Definition at line 217 of file xmladaptivemodel.cpp.

Referenced by XmlAdaptiveModel::receiveData.

#define INCREASE_CLUE_EDGE
 

Value:

{                                               \
  clueEdge++;                                   \
  DBG("value of clue edge after the incrementation " << clueEdge);\
}
Increases the value of clueEdge.

Definition at line 183 of file xmladaptivemodel.cpp.

Referenced by XmlAdaptiveModel::manageEvent.

#define REPORT_DIFFERENT_EDGE _edge_   
 

Value:

{                                                                               \
  DBG("edge no. " << edge << " selected");                                      \
  grammar->append(AdaptiveStructuralSymbols::DifferentEdge);                    \
  fibItems = Fibonacci::encodeToBuffer(fibBuf, SIZEOF_XML_CHAR, _edge_);        \
  APPEND_BUFFER_DATA(grammar, fibBuf, fibItems);                                \
}
Appends data reporting a different edge to the grammar.

Parameters:
_edge_  Id of selected edge.

Definition at line 207 of file xmladaptivemodel.cpp.

Referenced by XmlAdaptiveModel::manageEvent.

#define REPORT_NACK
 

Value:

{                                                                               \
  DBG("NACK edge: " << clueEdge);                                               \
                                                                                \
  grammar->append(AdaptiveStructuralSymbols::NACK);                             \
  fibItems = Fibonacci::encodeToBuffer(fibBuf, SIZEOF_XML_CHAR, clueEdge);      \
  APPEND_BUFFER_DATA(grammar, fibBuf, fibItems);                                \
  DBG("FIB ITEMS: " << (unsigned int)fibBuf[0]);                                \
}
Appends the NACK informations to the grammar.

Definition at line 191 of file xmladaptivemodel.cpp.

Referenced by XmlAdaptiveModel::manageEvent.

#define RESET_BUFFER
 

Value:

{                                       \
  buffer[0] = 0;                        \
  bufferLength = 0;                     \
}
Resets (empties) the input buffer.

Definition at line 47 of file xmladaptivemodel.cpp.

Referenced by XmlAdaptiveModel::receiveData.

#define RESET_CLUE_EDGE
 

Value:

{                                               \
  clueEdge = 1;                                 \
  DBG("CLUE EDGE RESET!");\
}
Resets the clueEdge value.

Definition at line 175 of file xmladaptivemodel.cpp.

Referenced by XmlAdaptiveModel::manageEvent.

#define SAFE_CALL_EMITTER _x_   
 

Value:

if (saxEmitter)                         \
  saxEmitter->_x_;
Call SAX emitter in a safe way.

The methods of the emitter are called only if the emitter exists.

Parameters:
_x_  The name of the called method of the emitter.

Definition at line 41 of file xmladaptivemodel.cpp.

Referenced by XmlSimpleModel::receiveData, and XmlAdaptiveModel::receiveData.


Generated on Wed Feb 5 10:43:03 2003 for Exalt by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002