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

params.h

00001 /***************************************************************************
00002  *   Copyright (C) 2004-2006 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 PARAMS_H
00021 #define PARAMS_H
00022 
00023 class params
00024 {
00025 typedef grammar_to_parser::parsers parser_list;
00026 public:
00027         class name
00028         {
00029         public:
00030                 grammar_to_parser::pattern_parser                               m_param;
00031                 grammar_to_parser::value_parser<std::string>    m_name;
00032                 
00033                 name() : m_param("name:") {};
00034                 void push_parsers( parser_list &l )
00035                 {
00036                         l.push_back(&m_param);
00037                         l.push_back(&m_name);
00038                 }
00039                 operator std::string()
00040                 {
00041                         return m_name.get_valid();
00042                 }
00043         };
00044         class age
00045         {
00046         public:
00047                 grammar_to_parser::pattern_parser                               m_param;
00048                 grammar_to_parser::value_parser<unsigned long>  m_age;
00049                 
00050                 age() : m_param("age:") {};
00051                 void push_parsers( parser_list &l )
00052                 {
00053                         l.push_back(&m_param);
00054                         l.push_back(&m_age);
00055                 }
00056                 operator unsigned long()
00057                 {
00058                         return m_age.get_valid();
00059                 }
00060         };
00061         class company
00062         {
00063         public:
00064                 grammar_to_parser::pattern_parser                               m_param;
00065                 grammar_to_parser::value_parser<std::string>    m_company;
00066                 
00067                 company() : m_param("company:") {};
00068                 void push_parsers( parser_list &l )
00069                 {
00070                         l.push_back(&m_param);
00071                         l.push_back(&m_company);
00072                 }
00073                 operator std::string()
00074                 {
00075                         return m_company.get_valid();
00076                 }
00077         };
00078         grammar_to_parser::non_terminal<name>           m_name;
00079         grammar_to_parser::non_terminal<age>            m_age;
00080         grammar_to_parser::non_terminal<company>        m_company;
00081         
00082         void push_parsers( parser_list &l )
00083         {
00084                 l.push_back(&m_name);
00085                 l.push_back(&m_age);
00086                 l.push_back(&m_company);
00087         }
00088         
00089         
00090 };
00091 
00092 #endif

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