Main Page | Class Hierarchy | Class List | Directories | File List | Class Members

xml_attribute_parser.h

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 #ifndef GRAMMAR_TO_PARSERBASIC_XML_ATTRIBUTE_PARSER_H
00021 #define GRAMMAR_TO_PARSERBASIC_XML_ATTRIBUTE_PARSER_H
00022 
00023 namespace xml_parser {
00028 template< typename E >
00029 class basic_xml_attribute_parser : 
00030                         public grammar_to_parser::basic_simple_non_terminal<E>
00031 {
00032 public:
00033 typedef typename grammar_to_parser::basic_parser<E>::parser_list parser_list;
00034 typedef typename grammar_to_parser::basic_parser<E>::parser_list_iterator
00035                                                                                                                 parser_list_iterator;
00036         
00037         enum use_type
00038         {
00039                 OPTIONAL,
00040                 REQUIRED,
00041                 PROHIBITED
00042         };
00043                 
00044         basic_xml_attribute_parser( std::basic_string<E> attribute_name, 
00045                                         use_type a_use_type ) :
00046                 grammar_to_parser::basic_simple_non_terminal<E>(),
00047                 m_attribute_name( attribute_name ),
00048                 m_assignment( std::basic_string<E>(1,'=') ),
00049                 m_use_type( a_use_type)
00050         {};
00051 
00052         virtual void push_parsers( parser_list &l )
00053         {
00054                 l.push_back(&m_attribute_name);
00055                 l.push_back(&m_assignment);
00056         }
00057 
00058         use_type get_use_type()
00059         {
00060                 return m_use_type;
00061         }
00062                 
00063 protected:
00064         grammar_to_parser::basic_pattern_parser<E>      m_attribute_name;
00065         grammar_to_parser::basic_pattern_parser<E>      m_assignment;
00066         
00067         use_type                                                                        m_use_type;
00068 };
00069 
00070 typedef basic_xml_attribute_parser<char> xml_attribute_parser;
00071 typedef basic_xml_attribute_parser<wchar_t> wxml_attribute_parser;
00072 
00073 };
00074 
00075 #endif

Generated on Sun Jul 2 18:39:43 2006 for grammar2parser.kdevelop by  doxygen 1.4.1