Cleaned up every thing, prepared to remove deprecated interface.
[SXSI/xpathcomp.git] / SXSIStorageInterface.cpp
1 /*******************************************
2  * SXSIStorageInterface.cpp
3  * ------------------------
4  *
5  * 
6  * Author: Kim Nguyen
7  * Date: 04/11/08
8  */
9
10
11 #include "SXSIStorageInterface.h"
12 #include "Utils.h"
13
14 SXSIStorageInterface::SXSIStorageInterface(int sf,bool iet,bool dtc)
15 {
16   tree = NULL;
17   tb = new XMLTreeBuilder();
18   tb ->OpenDocument(iet,sf,dtc);
19 }
20
21 SXSIStorageInterface::~SXSIStorageInterface()
22 {
23 }
24
25 void SXSIStorageInterface::newChild(string name)
26
27   tb->NewOpenTag(name);
28 }
29
30
31 void SXSIStorageInterface::newText(string text)
32 {
33
34   tb->NewText(text);
35 }
36
37
38 void SXSIStorageInterface::nodeFinished(string name)
39 {  
40   tb->NewClosingTag(name);
41
42 }             
43               
44   void SXSIStorageInterface::parsingFinished()
45 {
46
47   tree = tb->CloseDocument();
48         
49 }
50
51 void *SXSIStorageInterface::returnDocument(){
52 #ifdef DEBUG
53   printStats();
54 #endif
55   return ((void *) tree);
56   
57 }
58
59 void SXSIStorageInterface::printStats(){
60   std::cerr << "Parsing stats :  \n";
61   std::cerr << _new_child << " calls to newOpenTag/newClosingTag\n";
62   std::cerr << _new_text << " calls to newText\n";
63   std::cerr << _new_empty_text << " calls to newEmptyText\n";
64   std::cerr << _length_text << " bytes (=" << _length_text/1024 << "kb ) added to TextCollection\n";
65   return;
66 }