00001 /*************************************************************************** 00002 * Copyright (C) 2005 by Radko Mihal * 00003 * rmihal@pobox.sk * 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 2 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, write to the * 00017 * Free Software Foundation, Inc., * 00018 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * 00019 ***************************************************************************/ 00020 namespace xml_parser { 00025 template< typename E > 00026 class basic_xml_param_parser : public grammar_to_parser::basic_simple_non_terminal<E> 00027 { 00028 public: 00029 basic_xml_param_parser( std::basic_string<E> param_name, 00030 std::basic_string<E> regexp_def ) : 00031 grammar_to_parser::basic_simple_non_terminal<E>(), 00032 m_param_name( param_name ), 00033 m_assignment( std::basic_string<E>(1,'=') ), 00034 m_param_value( regexp_def ) 00035 {}; 00036 00037 virtual void get_symbols( parser_list &l ) 00038 { 00039 l.push_back(&m_param_name); 00040 l.push_back(&m_assignment); 00041 l.push_back(&m_param_value); 00042 } 00043 00044 operator std::basic_string<E>() 00045 { 00046 return m_param_value.get_valid(); 00047 } 00048 protected: 00049 grammar_to_parser::basic_pattern_parser<E> m_param_name; 00050 grammar_to_parser::basic_pattern_parser<E> m_assignment; 00051 grammar_to_parser::basic_regexp_parser<E> m_param_value; 00052 }; 00053 00054 typedef basic_xml_param_parser<char> xml_param_parser; 00055 typedef basic_xml_param_parser<wchar_t> wxml_param_parser; 00056 00057 };