00001 // 00002 // aegis - project change supervisor 00003 // Copyright (C) 2005, 2006, 2008 Peter Miller 00004 // 00005 // This program is free software; you can redistribute it and/or modify 00006 // it under the terms of the GNU General Public License as published by 00007 // the Free Software Foundation; either version 3 of the License, or 00008 // (at your option) any later version. 00009 // 00010 // This program is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with this program. If not, see 00017 // <http://www.gnu.org/licenses/>. 00018 // 00019 00020 #ifndef LIBAEGIS_XMLTEXTREAD_BY_NODE_H 00021 #define LIBAEGIS_XMLTEXTREAD_BY_NODE_H 00022 00023 #include <common/symtab/template.h> 00024 #include <libaegis/xmltextread.h> 00025 00026 class xml_node; // forward 00027 00032 class xml_text_reader_by_node: 00033 public xml_text_reader 00034 { 00035 public: 00039 virtual ~xml_text_reader_by_node(); 00040 00044 xml_text_reader_by_node(input &deeper, bool validate = false); 00045 00060 void register_node_handler(const nstring &name, xml_node &handler); 00061 00062 // See base class for documentation. 00063 void process_node(); 00064 00065 // See base class for documentation. 00066 void process_node_end(bool empty); 00067 00068 private: 00073 symtab<xml_node> handlers; 00074 00079 nstring_list names; 00080 00085 xml_node *current_node; 00086 00091 void push_name(const nstring &name); 00092 00097 void pop_name(const nstring &name); 00098 00103 void calculate_current_node_handler(); 00104 00108 xml_text_reader_by_node(); 00109 00113 xml_text_reader_by_node(const xml_text_reader_by_node &); 00114 00118 xml_text_reader_by_node &operator=(const xml_text_reader_by_node &); 00119 }; 00120 00121 #endif // LIBAEGIS_XMLTEXTREAD_BY_NODE_H