{
namespace lexical
{
- namespace rule
+ ////////////////////////////////////////////////////////////////////
+
+ template <typename T>
+ class fixed : public length_<sizeof(T)>
{
- ////////////////////////////////////////////////////////////////////
+ private:
+ static const T data;
+ public:
+ fixed(const T& fixed_data) : data(fixed_data){}
- template <typename T>
- class fixed : public length_<sizeof(T)>
+ /////////////////
+
+ template <typename InputIterator, typename _Param>
+ bool analyze(InputIterator& it, const _Param& param) const
{
- private:
- static const T data;
- public:
- fixed(const T& fixed_data) : data(fixed_data){}
-
- /////////////////
-
- template <typename InputIterator, typename _Param>
- bool analyze(InputIterator& it, const _Param& param) const
- {
- bool ret = (*it == data);
- if ( ret )
- it++;
- return ret;
- }
+ bool ret = (*it == data);
+ if ( ret )
+ it++;
+ return ret;
+ }
- //----
-
- template <typename OutputStream, typename _Document>
- void generate(OutputStream& os, const _Document& doc) const
- {
- os << data;
- }
- };
+ //----
+
+ template <typename OutputStream, typename _Document>
+ void generate(OutputStream& os, const _Document& doc) const
+ {
+ os << data;
+ }
+ };
- ////////////////////////////////////////////////////////////////////
- }
+ ////////////////////////////////////////////////////////////////////
}
}
};
/////////////////////////////////////////////////////////////
-/*
+
template <unsigned char _ByteCode>
class unibyte : public fixed_numeric<unsigned char, _ByteCode> {};
- template <char _Val>
- class fixed_char : public fixed_numeric<char, _Val> {};
- template <short _Val>
- class fixed_short : public fixed_numeric<short, _Val> {};
- template <int _Val>
- class fixed_int : public fixed_numeric<int, _Val> {};
- template <long _Val>
- class fixed_long : public fixed_numeric<long, _Val> {};
-
- template <unsigned char _Val>
- class fixed_uchar : public fixed_numeric<unsigned char, _Val> {};
- template <unsigned short _Val>
- class fixed_ushort : public fixed_numeric<unsigned short, _Val> {};
- template <unsigned int _Val>
- class fixed_uint : public fixed_numeric<unsigned int, _Val> {};
- template <unsigned long _Val>
- class fixed_ulong : public fixed_numeric<unsigned long, _Val> {};
-
- typedef unibyte<0> zeroterm;
- */
+ template <char _Value>
+ class fixed_char : public fixed_numeric<char, _Value> {};
+ template <short _Value>
+ class fixed_short : public fixed_numeric<short, _Value> {};
+ template <int _Value>
+ class fixed_int : public fixed_numeric<int, _Value> {};
+ template <long _Value>
+ class fixed_long : public fixed_numeric<long, _Value> {};
+
+ template <unsigned char _Value>
+ class fixed_uchar : public fixed_numeric<unsigned char, _Value> {};
+ template <unsigned short _Value>
+ class fixed_ushort : public fixed_numeric<unsigned short, _Value> {};
+ template <unsigned int _Value>
+ class fixed_uint : public fixed_numeric<unsigned int, _Value> {};
+ template <unsigned long _Value>
+ class fixed_ulong : public fixed_numeric<unsigned long, _Value> {};
+
+ //typedef unibyte<0> zeroterm;
+
////////////////////////////////////////////////////////////////////
}
}