From d1f7b28c5fcb2dcad457719183eee07b1c36d3a9 Mon Sep 17 00:00:00 2001 From: myun2 Date: Mon, 11 Jun 2012 23:53:35 +0900 Subject: [PATCH] fixed_numeric.hpp --- roast/include/roast/lexical2/fixed.hpp | 55 ++++++++++++-------------- roast/include/roast/lexical2/fixed_numeric.hpp | 42 ++++++++++---------- roast/include/roast/lexical2/lexical.hpp | 2 +- 3 files changed, 48 insertions(+), 51 deletions(-) diff --git a/roast/include/roast/lexical2/fixed.hpp b/roast/include/roast/lexical2/fixed.hpp index 73cc4219..4023fdb8 100644 --- a/roast/include/roast/lexical2/fixed.hpp +++ b/roast/include/roast/lexical2/fixed.hpp @@ -10,40 +10,37 @@ namespace roast { namespace lexical { - namespace rule + //////////////////////////////////////////////////////////////////// + + template + class fixed : public length_ { - //////////////////////////////////////////////////////////////////// + private: + static const T data; + public: + fixed(const T& fixed_data) : data(fixed_data){} - template - class fixed : public length_ + ///////////////// + + template + bool analyze(InputIterator& it, const _Param& param) const { - private: - static const T data; - public: - fixed(const T& fixed_data) : data(fixed_data){} - - ///////////////// - - template - 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 - void generate(OutputStream& os, const _Document& doc) const - { - os << data; - } - }; + //---- + + template + void generate(OutputStream& os, const _Document& doc) const + { + os << data; + } + }; - //////////////////////////////////////////////////////////////////// - } + //////////////////////////////////////////////////////////////////// } } diff --git a/roast/include/roast/lexical2/fixed_numeric.hpp b/roast/include/roast/lexical2/fixed_numeric.hpp index 2f57f8a4..625d93ae 100644 --- a/roast/include/roast/lexical2/fixed_numeric.hpp +++ b/roast/include/roast/lexical2/fixed_numeric.hpp @@ -22,30 +22,30 @@ namespace roast }; ///////////////////////////////////////////////////////////// -/* + template class unibyte : public fixed_numeric {}; - template - class fixed_char : public fixed_numeric {}; - template - class fixed_short : public fixed_numeric {}; - template - class fixed_int : public fixed_numeric {}; - template - class fixed_long : public fixed_numeric {}; - - template - class fixed_uchar : public fixed_numeric {}; - template - class fixed_ushort : public fixed_numeric {}; - template - class fixed_uint : public fixed_numeric {}; - template - class fixed_ulong : public fixed_numeric {}; - - typedef unibyte<0> zeroterm; - */ + template + class fixed_char : public fixed_numeric {}; + template + class fixed_short : public fixed_numeric {}; + template + class fixed_int : public fixed_numeric {}; + template + class fixed_long : public fixed_numeric {}; + + template + class fixed_uchar : public fixed_numeric {}; + template + class fixed_ushort : public fixed_numeric {}; + template + class fixed_uint : public fixed_numeric {}; + template + class fixed_ulong : public fixed_numeric {}; + + //typedef unibyte<0> zeroterm; + //////////////////////////////////////////////////////////////////// } } diff --git a/roast/include/roast/lexical2/lexical.hpp b/roast/include/roast/lexical2/lexical.hpp index db9fb3ef..7a5116ea 100644 --- a/roast/include/roast/lexical2/lexical.hpp +++ b/roast/include/roast/lexical2/lexical.hpp @@ -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" -- 2.11.0