#include "Behavioural/include/XMLLightFunctors.h" using namespace morpheo::XMLUtils; using namespace std; //****************************XMLLightComparator method implementation*****************************// // the comparator functor used within parsing algorithm. bool XMLLightComparator::operator() ( char firstChar, char secondChar ) { static unsigned int counter = 0; static bool searchForEndTag = false; if ( searchForEndTag ) { if ( secondChar == END_TAG ) { searchForEndTag = false; return true; } return false; } if ( ( firstChar == BEGIN_TAG && secondChar == SECOND_TAG ) || ( firstChar == SECOND_TAG && secondChar == END_TAG ) ) { --counter; if ( ! counter ) { if( firstChar == SECOND_TAG ) { return true; } searchForEndTag = true; return false; } return false; } else if ( firstChar == BEGIN_TAG ) { counter++; return false; } else { return false; } }