X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=SXSIStorageInterface.cpp;h=e5bd7cf873c798d796ec02a6ddd28b5a3f3f27b6;hb=c10ce35cd399aff15a49f3b24a31b38cb2191da0;hp=bd21cd0e12979ea65e79a85c9d61a8b84d294ea3;hpb=c8f4fdfb1408aee5e3a4b402ff1ead9c3cdd9a4c;p=SXSI%2Fxpathcomp.git diff --git a/SXSIStorageInterface.cpp b/SXSIStorageInterface.cpp index bd21cd0..e5bd7cf 100644 --- a/SXSIStorageInterface.cpp +++ b/SXSIStorageInterface.cpp @@ -15,7 +15,7 @@ SXSIStorageInterface::SXSIStorageInterface() { tree = new XMLTree(); - tree->OpenDocument(true,1); + tree->OpenDocument(false,64); } SXSIStorageInterface::~SXSIStorageInterface() @@ -24,33 +24,50 @@ SXSIStorageInterface::~SXSIStorageInterface() void SXSIStorageInterface::newChild(string name) { + _new_child++; tree->NewOpenTag((unsigned char*) name.c_str()); } void SXSIStorageInterface::newText(string text) { - if (text.empty()) + + if (text.empty()) { + _new_empty_text++; tree->NewEmptyText(); - else - tree->NewText((unsigned char*) text.c_str()); - } + } + else { + _new_text++; + _length_text += text.size(); + tree->NewText((unsigned char*) text.c_str()); + } +} void SXSIStorageInterface::nodeFinished(string name) { - tree->NewClosingTag((unsigned char*) name.c_str()); + tree->NewClosingTag((unsigned char*) name.c_str()); } void SXSIStorageInterface::parsingFinished() { - tree->CloseDocument(); + + tree->CloseDocument(); } void *SXSIStorageInterface::returnDocument(){ + printStats(); 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; +}