00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef XML_PARSERXML_NUMBER_ATTRIBUTE_PARESE_H
00021 #define XML_PARSERXML_NUMBER_ATTRIBUTE_PARESE_H
00022
00023 #include <xml_attribute_parser.h>
00024
00025 namespace xml_parser {
00026
00031 template< typename E, typename A >
00032 class basic_xml_number_attribute_parser : public basic_xml_attribute_parser<E>
00033 {
00034 typedef typename grammar_to_parser::basic_parser<E>::parser_list parser_list;
00035 typedef typename basic_xml_attribute_parser<E>::use_type use_type;
00036 public:
00037 basic_xml_number_attribute_parser(std::basic_string< E > attribute_name,
00038 use_type a_use_type,
00039 A default_value = 0 ) :
00040 basic_xml_attribute_parser<E>( attribute_name, a_use_type ),
00041 m_attribute_value(),
00042 m_default_value(default_value) {};
00043
00044 virtual void push_parsers( parser_list &l )
00045 {
00046 basic_xml_attribute_parser<E>::push_parsers(l);
00047 l.push_back(&m_attribute_value);
00048 }
00049
00050 use_type get_use_type()
00051 {
00052 return m_use_type;
00053 }
00054
00055 operator A()
00056 {
00057 return m_attribute_value.get_valid();
00058 }
00059 protected:
00060 grammar_to_parser::basic_value_parser<E,A> m_attribute_value;
00061
00062 A m_default_value;
00063
00064 };
00065
00066 template< typename A >
00067 class xml_number_attribute_parser : public basic_xml_number_attribute_parser<char,A>
00068 {
00069 typedef typename basic_xml_attribute_parser<A>::use_type use_type;
00070 public:
00071 xml_number_attribute_parser(std::string attribute_name,
00072 use_type a_use_type,
00073 A default_value = 0 ) :
00074 basic_xml_number_attribute_parser<char,A>( attribute_name, a_use_type ) {};
00075 };
00076
00077 template< typename A >
00078 class wxml_number_attribute_parser : public basic_xml_number_attribute_parser<wchar_t,A>
00079 {
00080 typedef typename basic_xml_attribute_parser<wchar_t>::use_type use_type;
00081 public:
00082 wxml_number_attribute_parser(std::wstring attribute_name,
00083 use_type a_use_type,
00084 A default_value = 0 ) :
00085 basic_xml_number_attribute_parser<wchar_t,A>( attribute_name, a_use_type ) {};
00086 };
00087
00088 };
00089
00090 #endif