From aa02ee846c3676de9d73d7b23641452c8630a130 Mon Sep 17 00:00:00 2001 From: Myun2 Date: Sun, 27 Nov 2011 12:26:33 +0900 Subject: [PATCH] =?utf8?q?ptr.hpp=20=E8=BF=BD=E5=8A=A0=20=E5=BC=95?= =?utf8?q?=E6=95=B0=E3=81=AA=E3=81=97=E3=81=AB=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../include/roast/lexical/variable/basic_types.hpp | 2 + roast/include/roast/lexical/variable/numeric.hpp | 50 +++++++++++++-------- roast/include/roast/lexical/variable/ptr.hpp | 51 ++++++++++++++++++++++ 3 files changed, 86 insertions(+), 17 deletions(-) create mode 100644 roast/include/roast/lexical/variable/ptr.hpp diff --git a/roast/include/roast/lexical/variable/basic_types.hpp b/roast/include/roast/lexical/variable/basic_types.hpp index 7af82868..95bf6a6f 100644 --- a/roast/include/roast/lexical/variable/basic_types.hpp +++ b/roast/include/roast/lexical/variable/basic_types.hpp @@ -16,6 +16,7 @@ namespace roast struct _basic_type { T value; + _basic_type(){} _basic_type(const T& v):value(v){} }; @@ -25,5 +26,6 @@ namespace roast } #include "roast/lexical/variable/numeric.hpp" +#include "roast/lexical/variable/ptr.hpp" #endif//__SFJP_ROAST__lexical__variable__basic_types_HPP__ diff --git a/roast/include/roast/lexical/variable/numeric.hpp b/roast/include/roast/lexical/variable/numeric.hpp index 9a91a80d..cbb899e9 100644 --- a/roast/include/roast/lexical/variable/numeric.hpp +++ b/roast/include/roast/lexical/variable/numeric.hpp @@ -11,47 +11,63 @@ namespace roast namespace variable { ////////////////////////////////////////////////////// - - struct char_ : public _basic_type + + template + struct numeric_ : public _basic_type + { + //numeric_():_basic_type(0){} + numeric_(T v=0):_basic_type(v){} + }; + + ///// + struct char_ : public numeric_ { - char_(char v):_basic_type(v){} + char_(){} + char_(char v):numeric_(v){} }; - struct short_ : public _basic_type + struct short_ : public numeric_ { - short_(short v):_basic_type(v){} + short_(){} + short_(short v):numeric_(v){} }; - struct int_ : public _basic_type + struct int_ : public numeric_ { - int_(int v):_basic_type(v){} + int_(){} + int_(int v):numeric_(v){} }; - struct long_ : public _basic_type + struct long_ : public numeric_ { - long_(long v):_basic_type(v){} + long_(){} + long_(long v):numeric_(v){} }; /////// - struct uchar_ : public _basic_type + struct uchar_ : public numeric_ { - uchar_(unsigned char v):_basic_type(v){} + uchar_(){} + uchar_(unsigned char v):numeric_(v){} }; - struct ushort_ : public _basic_type + struct ushort_ : public numeric_ { - ushort_(unsigned short v):_basic_type(v){} + ushort_(){} + ushort_(unsigned short v):numeric_(v){} }; - struct uint_ : public _basic_type + struct uint_ : public numeric_ { - uint_(unsigned int v):_basic_type(v){} + uint_(){} + uint_(unsigned int v):numeric_(v){} }; - struct ulong_ : public _basic_type + struct ulong_ : public numeric_ { - ulong_(unsigned long v):_basic_type(v){} + ulong_(){} + ulong_(unsigned long v):numeric_(v){} }; ////////////////////////////////////////////////////// diff --git a/roast/include/roast/lexical/variable/ptr.hpp b/roast/include/roast/lexical/variable/ptr.hpp new file mode 100644 index 00000000..20d2bdc3 --- /dev/null +++ b/roast/include/roast/lexical/variable/ptr.hpp @@ -0,0 +1,51 @@ +// Roast+ License +/* +*/ +#ifndef __SFJP_ROAST__lexical__variable__ptr_HPP__ +#define __SFJP_ROAST__lexical__variable__ptr_HPP__ + +namespace roast +{ + namespace lexical + { + namespace variable + { + ////////////////////////////////////////////////////// + + template + struct ptr_ : public _basic_type + { + ptr_(T* v=0):_basic_type(v){} + }; + + //// + struct char_ptr : public ptr_ + { + char_ptr(){} + char_ptr(char* v):ptr_(v){} + }; + + struct const_char_ptr : public ptr_ + { + const_char_ptr(){} + const_char_ptr(const char* v):ptr_(v){} + }; + + struct void_ptr : public ptr_ + { + void_ptr(){} + void_ptr(void* v):ptr_(v){} + }; + + struct const_void_ptr : public ptr_ + { + const_void_ptr(){} + const_void_ptr(const void* v):ptr_(v){} + }; + + ////////////////////////////////////////////////////// + } + } +} + +#endif//__SFJP_ROAST__lexical__variable__ptr_HPP__ -- 2.11.0