Remove spurious printfs.
[SXSI/XMLTree.git] / xml-tree-builder.hpp
1 #ifndef XML_TREE_BUILDER_HPP_
2 #define XML_TREE_BUILDER_HPP_
3
4 #include <cstdint>
5 #include <unordered_map>
6 #include "xml-tree.hpp"
7 #include "bit-vector.hpp"
8 #undef W
9 #undef WW
10 #undef Wminusone
11 #include <TextCollection/TextCollectionBuilder.h>
12
13 class xml_tree_builder {
14
15 public:
16   xml_tree_builder();
17   ~xml_tree_builder();
18   void open_document(bool disable_text_index,
19                      unsigned int sample_rate,
20                      SXSI::TextCollectionBuilder::index_type_t idx_type);
21
22   xml_tree *close_document();
23   void open_tag(std::string);
24   void close_tag(std::string);
25   void text(std::string);
26
27 private:
28   void reset();
29   int32_t register_tag(std::string);
30   int32_t register_tag(std::string, int32_t);
31
32
33   bit_vector *par;
34   std::vector<int32_t> *tags;
35   int32_t current_tag;
36   std::unordered_map<std::string, int32_t> *tag_ids;
37   bool opened;
38
39
40   bit_vector *text_positions;
41   SXSI::TextCollectionBuilder *tc_builder;
42   bool disable_text_index;
43   SXSI::TextCollectionBuilder::index_type_t text_index_type;
44
45 };
46
47
48 #endif