Last change
on this file since 125 was
88,
checked in by rosiere, 16 years ago
|
Almost complete design
with Test and test platform
|
-
Property svn:keywords set to
Id
|
File size:
1010 bytes
|
Rev | Line | |
---|
[88] | 1 | #include "Behavioural/include/XMLLightFunctors.h" |
---|
| 2 | |
---|
| 3 | using namespace morpheo::XMLUtils; |
---|
| 4 | using namespace std; |
---|
| 5 | |
---|
| 6 | //****************************XMLLightComparator method implementation*****************************// |
---|
| 7 | |
---|
| 8 | // the comparator functor used within parsing algorithm. |
---|
| 9 | |
---|
| 10 | bool XMLLightComparator::operator() ( char firstChar, char secondChar ) { |
---|
| 11 | static unsigned int counter = 0; |
---|
| 12 | static bool searchForEndTag = false; |
---|
| 13 | |
---|
| 14 | if ( searchForEndTag ) { |
---|
| 15 | if ( secondChar == END_TAG ) { |
---|
| 16 | searchForEndTag = false; |
---|
| 17 | return true; |
---|
| 18 | } |
---|
| 19 | return false; |
---|
| 20 | } |
---|
| 21 | |
---|
| 22 | if |
---|
| 23 | ( ( firstChar == BEGIN_TAG && secondChar == SECOND_TAG ) || |
---|
| 24 | ( firstChar == SECOND_TAG && secondChar == END_TAG ) ) { |
---|
| 25 | --counter; |
---|
| 26 | if ( ! counter ) { |
---|
| 27 | if( firstChar == SECOND_TAG ) { |
---|
| 28 | return true; |
---|
| 29 | } |
---|
| 30 | searchForEndTag = true; |
---|
| 31 | return false; |
---|
| 32 | } |
---|
| 33 | return false; |
---|
| 34 | } |
---|
| 35 | else if ( firstChar == BEGIN_TAG ) { |
---|
| 36 | counter++; |
---|
| 37 | return false; |
---|
| 38 | } |
---|
| 39 | else { |
---|
| 40 | return false; |
---|
| 41 | } |
---|
| 42 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.