Cleaning dead code
[SXSI/xpathcomp.git] / SXSIStorageInterface.cpp
index 14c1d70..88ed42f 100644 (file)
 #include "SXSIStorageInterface.h"
 #include "Utils.h"
 
-
-SXSIStorageInterface::SXSIStorageInterface()
+SXSIStorageInterface::SXSIStorageInterface(int sf,bool iet,bool dtc)
 {
   tree = new XMLTree();
-  tree->OpenDocument(true,1);
+  tree->OpenDocument(iet,sf,dtc);
 }
 
 SXSIStorageInterface::~SXSIStorageInterface()
@@ -24,40 +23,52 @@ SXSIStorageInterface::~SXSIStorageInterface()
 
 void SXSIStorageInterface::newChild(string name)
 { 
-  cerr << "New child " << name << "\n";
+  _new_child++;
   tree->NewOpenTag((unsigned char*) name.c_str());
 }
 
 
 void SXSIStorageInterface::newText(string text)
 {
-  if (text.empty()){
-    cerr << "Calling newEmptyText()\n";
+
+  if (text.empty()) {
+    _new_empty_text++;
     tree->NewEmptyText();
   }
   else {
-    cerr << "Calling newText(" << text <<")\n";
-    tree->NewText((unsigned char*) text.c_str());
-    
-  };
+    _new_text++;
+    _length_text += text.size();
+    tree->NewText((unsigned char*) text.c_str());  
+  }
 }
-       
 
 
 void SXSIStorageInterface::nodeFinished(string name)
 {  
-    cerr << "Node Finished child " << name << "\n";
-   tree->NewClosingTag((unsigned char*) name.c_str());
- }           
+  tree->NewClosingTag((unsigned char*) name.c_str());
+
+}            
              
   void SXSIStorageInterface::parsingFinished()
 {
-   tree->CloseDocument();
+
+  tree->CloseDocument();
        
 }
 
 void *SXSIStorageInterface::returnDocument(){
-
+#ifdef DEBUG
+  printStats();
+#endif
   return ((void *) tree);
   
 }
+
+void SXSIStorageInterface::printStats(){
+  std::cerr << "Parsing stats :  \n";
+  std::cerr << _new_child << " calls to newOpenTag/newClosingTag\n";
+  std::cerr << _new_text << " calls to newText\n";
+  std::cerr << _new_empty_text << " calls to newEmptyText\n";
+  std::cerr << _length_text << " bytes (=" << _length_text/1024 << "kb ) added to TextCollection\n";
+  return;
+}