From: unknown Date: Sat, 2 Jun 2012 17:12:31 +0000 (+0900) Subject: structure Add. (move from main roast) X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;p=roast%2Fpendding.git structure Add. (move from main roast) --- diff --git a/include/roast/structure/basic_types.hpp b/include/roast/structure/basic_types.hpp new file mode 100644 index 0000000..a651941 --- /dev/null +++ b/include/roast/structure/basic_types.hpp @@ -0,0 +1,51 @@ +// Roast+ License +/* +*/ +#ifndef __SFJP_ROAST__structure__basic_types_HPP__ +#define __SFJP_ROAST__structure__basic_types_HPP__ + +namespace roast +{ + namespace structure + { + ////////////////////////////////////////////////////// + + template + class _basic_type : public _structure_base + { + public: + unsigned int size() const { return sizeof(T); } + + T m_value; + _basic_type(){} + _basic_type(const T& v):m_value(v){} + + ///////////////////////////////////////////// + + template + bool analyze(_It& it, _Param& param) + { + value = *it + return true; + } + + //---- + + template + bool generate(_Strm& strm, _Document& doc) + { + //strm << v; + strm << sized_ptr_((char*)&m_value,sizeof(T)); + return true; + } + }; + + ////////////////////////////////////////////////////// + } +} + +#include "roast/structure/numeric.hpp" +//#include "roast/structure/ptr.hpp" +//#include "roast/structure/array.hpp" + +#endif//__SFJP_ROAST__structure__basic_types_HPP__ diff --git a/include/roast/structure/draw.hpp b/include/roast/structure/draw.hpp new file mode 100644 index 0000000..cb40bbf --- /dev/null +++ b/include/roast/structure/draw.hpp @@ -0,0 +1,15 @@ +// Roast+ License +/* +*/ +#ifndef __SFJP_ROAST__structure__draw_HPP__ +#define __SFJP_ROAST__structure__draw_HPP__ + +namespace roast +{ + namespace structure + { + + } +} + +#endif//__SFJP_ROAST__structure__draw_HPP__ diff --git a/include/roast/structure/fixed_string.hpp b/include/roast/structure/fixed_string.hpp new file mode 100644 index 0000000..bc0a070 --- /dev/null +++ b/include/roast/structure/fixed_string.hpp @@ -0,0 +1,15 @@ +// Roast+ License +/* +*/ +#ifndef __SFJP_ROAST__structure__fixed_string_HPP__ +#define __SFJP_ROAST__structure__fixed_string_HPP__ + +namespace roast +{ + namespace structure + { + + } +} + +#endif//__SFJP_ROAST__structure__fixed_string_HPP__ diff --git a/include/roast/structure/numeric.hpp b/include/roast/structure/numeric.hpp new file mode 100644 index 0000000..facd463 --- /dev/null +++ b/include/roast/structure/numeric.hpp @@ -0,0 +1,75 @@ +// Roast+ License +/* +*/ +#ifndef __SFJP_ROAST__structure__numeric_HPP__ +#define __SFJP_ROAST__structure__numeric_HPP__ + +namespace roast +{ + namespace structure + { + ////////////////////////////////////////////////////// + + template + struct numeric_ : public _basic_type + { + numeric_():_basic_type(0){} + numeric_(T v):_basic_type(v){} + }; + + ///// + struct char_ : public numeric_ + { + char_(){} + char_(char v):numeric_(v){} + }; + + struct short_ : public numeric_ + { + short_(){} + short_(short v):numeric_(v){} + }; + + struct int_ : public numeric_ + { + int_(){} + int_(int v):numeric_(v){} + }; + + struct long_ : public numeric_ + { + long_(){} + long_(long v):numeric_(v){} + }; + + /////// + + struct uchar_ : public numeric_ + { + uchar_(){} + uchar_(unsigned char v):numeric_(v){} + }; + + struct ushort_ : public numeric_ + { + ushort_(){} + ushort_(unsigned short v):numeric_(v){} + }; + + struct uint_ : public numeric_ + { + uint_(){} + uint_(unsigned int v):numeric_(v){} + }; + + struct ulong_ : public numeric_ + { + ulong_(){} + ulong_(unsigned long v):numeric_(v){} + }; + + ////////////////////////////////////////////////////// + } +} + +#endif//__SFJP_ROAST__structure__numeric_HPP__ diff --git a/include/roast/structure/pour.hpp b/include/roast/structure/pour.hpp new file mode 100644 index 0000000..3be4eb4 --- /dev/null +++ b/include/roast/structure/pour.hpp @@ -0,0 +1,15 @@ +// Roast+ License +/* +*/ +#ifndef __SFJP_ROAST__structure__pour_HPP__ +#define __SFJP_ROAST__structure__pour_HPP__ + +namespace roast +{ + namespace structure + { + + } +} + +#endif//__SFJP_ROAST__structure__pour_HPP__ diff --git a/include/roast/structure/string.hpp b/include/roast/structure/string.hpp new file mode 100644 index 0000000..0e2c39d --- /dev/null +++ b/include/roast/structure/string.hpp @@ -0,0 +1,15 @@ +// Roast+ License +/* +*/ +#ifndef __SFJP_ROAST__structure__string_HPP__ +#define __SFJP_ROAST__structure__string_HPP__ + +namespace roast +{ + namespace structure + { + + } +} + +#endif//__SFJP_ROAST__structure__string_HPP__ diff --git a/include/roast/structure/structure.hpp b/include/roast/structure/structure.hpp new file mode 100644 index 0000000..3c99000 --- /dev/null +++ b/include/roast/structure/structure.hpp @@ -0,0 +1,41 @@ +// Roast+ License +/* +*/ +#ifndef __SFJP_ROAST__structure__structre_HPP__ +#define __SFJP_ROAST__structure__structre_HPP__ + +namespace roast +{ + namespace structure + { + ////////////////////////////////////////////////////// + + class _structure_base + { + }; + + ////// + + template + class _pod : public _structure_base + { + public: + T m_value; + _pod(){} + _pod(const T& v):m_value(v){} + + unsigned int size() const{ return sizeof(m_value); } + }; + + ////////////////////////////////////////////////////// + + template + void write_to_stream(_Strm& strm){ + + } + } +} + +#include "roast/structure/basic_types.hpp" + +#endif//__SFJP_ROAST__structure__structre_HPP__