• R/O
  • SSH
  • HTTPS

iris-fmw: Commit


Commit MetaInfo

Revision272 (tree)
Time2012-01-27 23:29:54
Authorshirayanagi

Log Message

constexpr 勉強
起動時引数クラス追加

Change Summary

Incremental Difference

--- trunk/framework/src/c++0x/cpp0x_constexpr.h (nonexistent)
+++ trunk/framework/src/c++0x/cpp0x_constexpr.h (revision 272)
@@ -0,0 +1,41 @@
1+//======================================================================
2+//-----------------------------------------------------------------------
3+/**
4+ * @file cpp0x_constexpr.h
5+ * @brief c++0x constexpr ファイル
6+ *
7+ * @author t.sirayanagi
8+ * @version 1.0
9+ *
10+ * @par copyright
11+ * Copyright (C) 2012 Takazumi Shirayanagi\n
12+ * The new BSD License is applied to this software.
13+ * see iris_LICENSE.txt
14+*/
15+//-----------------------------------------------------------------------
16+//======================================================================
17+#ifndef INCG_IRIS_cpp0x_constexpr_H_
18+#define INCG_IRIS_cpp0x_constexpr_H_
19+
20+//======================================================================
21+// include
22+
23+#ifndef _IRIS_HAS_CONSTEXPR
24+# if IRIS_GNUC_AT_LEAST(4, 6) && defined(__GXX_EXPERIMENTAL_CXX0X__)
25+# define _IRIS_HAS_CONSTEXPR 1
26+# else
27+# define _IRIS_HAS_CONSTEXPR 0
28+# endif
29+#endif
30+
31+#if _IRIS_HAS_CONSTEXPR
32+# define IRIS_CONSTEXPR constexpr
33+# define IRIS_CONSTEXPR_OR_CONST constexpr
34+# define constexpr_assert(x_) STATIC_ASSERT(x_) // constexpr には static_assert できるはず
35+#else
36+# define IRIS_CONSTEXPR
37+# define IRIS_CONSTEXPR_OR_CONST const
38+# define constexpr_assert(x_) IRIS_ASSERT(x_)
39+#endif
40+
41+#endif
--- trunk/framework/src/iris_compiler.h (revision 271)
+++ trunk/framework/src/iris_compiler.h (revision 272)
@@ -8,7 +8,7 @@
88 * @version 1.0
99 *
1010 * @par copyright
11- * Copyright (C) 2010-2011 Takazumi Shirayanagi\n
11+ * Copyright (C) 2010-2012 Takazumi Shirayanagi\n
1212 * The new BSD License is applied to this software.
1313 * see iris_LICENSE.txt
1414 */
@@ -397,10 +397,7 @@
397397
398398 //--------------------
399399 // constexpr
400-#if IRIS_GNUC_AT_LEAST(4, 6)
401-#else
402-# define constexpr // empty
403-#endif
400+#include "c++0x/cpp0x_constexpr.h"
404401
405402 //--------------------
406403 // endian
--- trunk/framework/src/fnd/image/FndColor.h (revision 271)
+++ trunk/framework/src/fnd/image/FndColor.h (revision 272)
@@ -199,10 +199,10 @@
199199 * @name 各成分の最大値
200200 * @{
201201 */
202- constexpr value_type_r max_r(void) const { return (((value_type_r)1<<BSZ_R)-1); }
203- constexpr value_type_g max_g(void) const { return (((value_type_g)1<<BSZ_G)-1); }
204- constexpr value_type_b max_b(void) const { return (((value_type_b)1<<BSZ_B)-1); }
205- constexpr value_type_a max_a(void) const { return (((value_type_a)1<<BSZ_A)-1); }
202+ IRIS_CONSTEXPR value_type_r max_r(void) const { return (((value_type_r)1<<BSZ_R)-1); }
203+ IRIS_CONSTEXPR value_type_g max_g(void) const { return (((value_type_g)1<<BSZ_G)-1); }
204+ IRIS_CONSTEXPR value_type_b max_b(void) const { return (((value_type_b)1<<BSZ_B)-1); }
205+ IRIS_CONSTEXPR value_type_a max_a(void) const { return (((value_type_a)1<<BSZ_A)-1); }
206206 /**
207207 * @}
208208 */
--- trunk/framework/src/fnd/system/FndBootArg.h (nonexistent)
+++ trunk/framework/src/fnd/system/FndBootArg.h (revision 272)
@@ -0,0 +1,77 @@
1+//======================================================================
2+//-----------------------------------------------------------------------
3+/**
4+ * @file FndBootArg.h
5+ * @brief 起動時引数の取得システム ファイル
6+ *
7+ * @author t.sirayanagi
8+ * @version 1.0
9+ *
10+ * @par copyright
11+ * Copyright (C) 2012 Takazumi Shirayanagi\n
12+ * The new BSD License is applied to this software.
13+ * see iris_LICENSE.txt
14+*/
15+//-----------------------------------------------------------------------
16+//======================================================================
17+#ifndef INCG_IRIS_FndBootArg_H_
18+#define INCG_IRIS_FndBootArg_H_
19+
20+//======================================================================
21+// include
22+#include "../container/FndSingleton.h"
23+#include "../../iris_tchar.h"
24+
25+namespace iris {
26+namespace fnd
27+{
28+
29+//======================================================================
30+// class
31+/**
32+ * @brief 起動時引数取得用クラス
33+*/
34+class CBootArgument : public CSingleton<CBootArgument>
35+{
36+ typedef CSingleton<CBootArgument> _Mybase;
37+public:
38+ static CBootArgument& GetInstance(void)
39+ {
40+ if( GetInstancePtr() == nullptr )
41+ {
42+ static CBootArgument def;
43+ return def;
44+ }
45+ return _Mybase::GetInstance();
46+ }
47+
48+ static int GetArgc(void) { return GetInstance().GetArgc_(); }
49+ static const TCHAR* GetArgv(int index) { return GetInstance().GetArgv_(index); }
50+
51+private:
52+ // argc
53+ virtual int GetArgc_(void) const
54+ {
55+#ifdef _WIN32
56+ return ::__argc;
57+#else
58+ return 0;
59+#endif
60+ }
61+ // argc
62+ virtual const TCHAR* GetArgv_(int index) const
63+ {
64+#ifdef _WIN32
65+ return ::__targv[index];
66+#else
67+ IRIS_UNUSED_VAR(index);
68+ return nullptr;
69+#endif
70+ }
71+};
72+
73+
74+} // end of namespace fnd
75+} // end of namespace iris
76+
77+#endif
Show on old repository browser