OSDN Git Service

fixed_numeric.hpp
authormyun2 <myun2@nwhite.info>
Mon, 11 Jun 2012 14:53:35 +0000 (23:53 +0900)
committermyun2 <myun2@nwhite.info>
Mon, 11 Jun 2012 14:53:35 +0000 (23:53 +0900)
roast/include/roast/lexical2/fixed.hpp
roast/include/roast/lexical2/fixed_numeric.hpp
roast/include/roast/lexical2/lexical.hpp

index 73cc421..4023fdb 100644 (file)
@@ -10,40 +10,37 @@ namespace roast
 {
        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;
+                       }
+               };
 
-                       ////////////////////////////////////////////////////////////////////
-               }
+               ////////////////////////////////////////////////////////////////////
        }
 }
 
index 2f57f8a..625d93a 100644 (file)
@@ -22,30 +22,30 @@ namespace roast
                };
 
                /////////////////////////////////////////////////////////////
-/*
+
                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;
+               
                ////////////////////////////////////////////////////////////////////
        }
 }
index db9fb3e..7a5116e 100644 (file)
@@ -10,7 +10,7 @@
 
 //     Types
 #include "roast/lexical2/empty_type.hpp"
-#include "roast/lexical2/fixed.hpp"
+#include "roast/lexical2/fixed_numeric.hpp"
 
 //     Utilities
 #include "roast/lexical2/lexical2_util.hpp"