X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=xml-tree-builder.hpp;fp=xml-tree-builder.hpp;h=7550824604d032358da1fcafd1f61cfc78a6af3f;hb=c6266d8fd1872fad45b18d3d554410d080b65099;hp=0000000000000000000000000000000000000000;hpb=03125db103d98200f7a313a38db54c56748283d1;p=SXSI%2FXMLTree.git diff --git a/xml-tree-builder.hpp b/xml-tree-builder.hpp new file mode 100644 index 0000000..7550824 --- /dev/null +++ b/xml-tree-builder.hpp @@ -0,0 +1,48 @@ +#ifndef XML_TREE_BUILDER_HPP_ +#define XML_TREE_BUILDER_HPP_ + +#include +#include +#include "xml-tree.hpp" +#include "bit-vector.hpp" +#undef W +#undef WW +#undef Wminusone +#include + +class xml_tree_builder { + +public: + xml_tree_builder(); + ~xml_tree_builder(); + void open_document(bool disable_text_index, + unsigned int sample_rate, + SXSI::TextCollectionBuilder::index_type_t idx_type); + + xml_tree *close_document(); + void open_tag(std::string); + void close_tag(std::string); + void text(std::string); + +private: + void reset(); + int32_t register_tag(std::string); + int32_t register_tag(std::string, int32_t); + + + bit_vector *par; + std::vector *tags; + int32_t current_tag; + std::unordered_map *tag_ids; + bool opened; + + + bit_vector *text_positions; + SXSI::TextCollectionBuilder *tc_builder; + bool disable_text_index; + SXSI::TextCollectionBuilder::index_type_t text_index_type; + +}; + + +#endif