OSDN Git Service

structure Add. (move from main roast) master
authorunknown <Administrator@edge.(none)>
Sat, 2 Jun 2012 17:12:31 +0000 (02:12 +0900)
committerunknown <Administrator@edge.(none)>
Sat, 2 Jun 2012 17:12:31 +0000 (02:12 +0900)
include/roast/structure/basic_types.hpp [new file with mode: 0644]
include/roast/structure/draw.hpp [new file with mode: 0644]
include/roast/structure/fixed_string.hpp [new file with mode: 0644]
include/roast/structure/numeric.hpp [new file with mode: 0644]
include/roast/structure/pour.hpp [new file with mode: 0644]
include/roast/structure/string.hpp [new file with mode: 0644]
include/roast/structure/structure.hpp [new file with mode: 0644]

diff --git a/include/roast/structure/basic_types.hpp b/include/roast/structure/basic_types.hpp
new file mode 100644 (file)
index 0000000..a651941
--- /dev/null
@@ -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 <typename T>
+               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 <typename _It, typename _Param>
+                       bool analyze(_It& it, _Param& param)
+                       {
+                               value = *it
+                               return true;
+                       }
+
+                       //----
+                       
+                       template <typename _Strm, typename _Document>
+                       bool generate(_Strm& strm, _Document& doc)
+                       {
+                               //strm << v;
+                               strm << sized_ptr_<char>((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 (file)
index 0000000..cb40bbf
--- /dev/null
@@ -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 (file)
index 0000000..bc0a070
--- /dev/null
@@ -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 (file)
index 0000000..facd463
--- /dev/null
@@ -0,0 +1,75 @@
+//     Roast+ License
+/*
+*/
+#ifndef __SFJP_ROAST__structure__numeric_HPP__
+#define __SFJP_ROAST__structure__numeric_HPP__
+
+namespace roast
+{
+       namespace structure
+       {
+               //////////////////////////////////////////////////////
+               
+               template <typename T>
+               struct numeric_ : public _basic_type<T>
+               {
+                       numeric_():_basic_type<T>(0){}
+                       numeric_(T v):_basic_type<T>(v){}
+               };
+               
+               /////
+               struct char_ : public numeric_<char>
+               {
+                       char_(){}
+                       char_(char v):numeric_<char>(v){}
+               };
+
+               struct short_ : public numeric_<short>
+               {
+                       short_(){}
+                       short_(short v):numeric_<short>(v){}
+               };
+
+               struct int_ : public numeric_<int>
+               {
+                       int_(){}
+                       int_(int v):numeric_<int>(v){}
+               };
+
+               struct long_ : public numeric_<long>
+               {
+                       long_(){}
+                       long_(long v):numeric_<long>(v){}
+               };
+               
+               ///////
+               
+               struct uchar_ : public numeric_<unsigned char>
+               {
+                       uchar_(){}
+                       uchar_(unsigned char v):numeric_<unsigned char>(v){}
+               };
+
+               struct ushort_ : public numeric_<unsigned short>
+               {
+                       ushort_(){}
+                       ushort_(unsigned short v):numeric_<unsigned short>(v){}
+               };
+
+               struct uint_ : public numeric_<unsigned int>
+               {
+                       uint_(){}
+                       uint_(unsigned int v):numeric_<unsigned int>(v){}
+               };
+
+               struct ulong_ : public numeric_<unsigned long>
+               {
+                       ulong_(){}
+                       ulong_(unsigned long v):numeric_<unsigned long>(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 (file)
index 0000000..3be4eb4
--- /dev/null
@@ -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 (file)
index 0000000..0e2c39d
--- /dev/null
@@ -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 (file)
index 0000000..3c99000
--- /dev/null
@@ -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 <typename T>
+               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 <typename _Strm>
+               void write_to_stream(_Strm& strm){
+
+               }
+       }
+}
+
+#include "roast/structure/basic_types.hpp"
+
+#endif//__SFJP_ROAST__structure__structre_HPP__