|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r70227 - in sandbox/enums/libs/enums/test: . enum_class pp
From: vicente.botet_at_[hidden]
Date: 2011-03-20 15:20:50
Author: viboes
Date: 2011-03-20 15:20:47 EDT (Sun, 20 Mar 2011)
New Revision: 70227
URL: http://svn.boost.org/trac/boost/changeset/70227
Log:
Enums: Added PP Seq macros tests
Added:
sandbox/enums/libs/enums/test/pp/
sandbox/enums/libs/enums/test/pp/enumerator_definition.pass.cpp (contents, props changed)
sandbox/enums/libs/enums/test/pp/enumerator_list.pass.cpp (contents, props changed)
Text files modified:
sandbox/enums/libs/enums/test/ExType.hpp | 3 +
sandbox/enums/libs/enums/test/Jamfile.v2 | 6 +++
sandbox/enums/libs/enums/test/enum_class/enum_inside_union_cons.pass.cpp | 79 +++++++++++++++++++++++++++++++++++++++
3 files changed, 86 insertions(+), 2 deletions(-)
Modified: sandbox/enums/libs/enums/test/ExType.hpp
==============================================================================
--- sandbox/enums/libs/enums/test/ExType.hpp (original)
+++ sandbox/enums/libs/enums/test/ExType.hpp 2011-03-20 15:20:47 EDT (Sun, 20 Mar 2011)
@@ -13,12 +13,13 @@
#ifndef EXTYPE_HPP
#define EXTYPE_HPP
+#include <boost/enums/scoped/enum_type_cons.hpp>
#include <boost/enums/scoped.hpp>
#include <boost/enums/ordinal.hpp>
#include <cstddef>
-#if 1
+#if 0
BOOST_ENUM_TYPE_START(EC3, int) {
Enum0,
Enum1,
Modified: sandbox/enums/libs/enums/test/Jamfile.v2
==============================================================================
--- sandbox/enums/libs/enums/test/Jamfile.v2 (original)
+++ sandbox/enums/libs/enums/test/Jamfile.v2 2011-03-20 15:20:47 EDT (Sun, 20 Mar 2011)
@@ -155,6 +155,12 @@
[ compile enum_range_c/back.pass.cpp : : enum_range_c__back__pass ]
;
+ test-suite "pp"
+ :
+ [ compile pp/enumerator_definition.pass.cpp ]
+ [ compile pp/enumerator_list.pass.cpp ]
+ ;
+
test-suite "examples"
:
[ run ../example/unsigned.cpp ]
Modified: sandbox/enums/libs/enums/test/enum_class/enum_inside_union_cons.pass.cpp
==============================================================================
--- sandbox/enums/libs/enums/test/enum_class/enum_inside_union_cons.pass.cpp (original)
+++ sandbox/enums/libs/enums/test/enum_class/enum_inside_union_cons.pass.cpp 2011-03-20 15:20:47 EDT (Sun, 20 Mar 2011)
@@ -11,6 +11,9 @@
//////////////////////////////////////////////////////////////////////////////
#include <boost/enums/scoped.hpp>
+#include <boost/enums/ordinal.hpp>
+#include <boost/enums/pp/enumerator_list.hpp>
+#include <boost/enums/pp/enum_declaration.hpp>
#if 0
@@ -23,8 +26,45 @@
}
BOOST_ENUMS_SPECIALIZATIONS(Ex::EC_Cons, int)
-#else
+enum ExtrinsecEnum {
+ Default = 3,
+ Enum1,
+ Enum2
+};
+
+struct UNS {
+enum type {
+ Default = 3,
+ Enum1,
+ Enum2
+};
+};
+
+template <typename E>
+struct NS
+{
+ typedef E type;
+};
+
+
+template <typename E>
+struct EC1 : NS<E>
+{
+};
+
+template <typename SE>
+struct EC2 : SE
+{
+};
+typedef EC2<UNS> ScopedEnum2;
+static const ScopedEnum2::type e1 = ScopedEnum2::Enum1;
+typedef EC1<ExtrinsecEnum> ScopedEnum1;
+//static const ScopedEnum1::type e2 = ScopedEnum1::Enum1; //error: âEnum1â is not a member of âScopedEnum1â
+
+
+#else
+#if 0
BOOST_ENUM_NS_CLASS_START((Ex)(EC_Cons), int) {
E0 = 3,
E1,
@@ -32,6 +72,43 @@
}
BOOST_ENUM_NS_CLASS_CONS_END( (Ex)(EC_Cons), int)
+
+namespace boost {
+ namespace enums {
+ namespace meta {
+ BOOST_ENUMS_ENUM_DCL_SIZE_SPE(MyNS_EC, MyENUMS)
+ BOOST_PP_SEQ_FOR_EACH(
+ BOOST_ENUMS_ENUM_DCL_POS_VAL_SPE,
+ BOOST_ENUMS_NAMESPACES_CLASS_QNAME(MyNS_EC),
+ MyENUMS
+ )
+ BOOST_ENUMS_ENUM_DCL_TRAITS_SPE(MyNS_EC, linear_enum_traiter)
+ }
+ }
+}
+
+#define MyNS_EC (Ex)(EC_Cons)
+#define MyENUMS ( (E0)(3) ) ( (E1) ) ( (E2) )
+
+
+BOOST_ENUM_NS_CLASS_START(MyNS_EC, int)
+{
+ BOOST_ENUMS_ENUMERATOR_LIST_GENERATE(MyENUMS)
+}
+BOOST_ENUM_NS_CLASS_CONS_END(MyNS_EC, int)
+BOOST_ENUMS_ENUM_DCL_SPE(MyNS_EC, MyENUMS, linear_enum_traiter)
+
+#else
+
+
+BOOST_ENUMS_ENUM_CLASS_DCL_CONS((Ex)(EC_Cons), int,
+ ( (E0)(3) )
+ ( (E1) )
+ ( (E2) )
+ , linear_enum_traiter)
+
+
+#endif
#endif
#if defined(BOOST_NO_ENUM_UNRESTRICTED_UNION)
Added: sandbox/enums/libs/enums/test/pp/enumerator_definition.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/enums/libs/enums/test/pp/enumerator_definition.pass.cpp 2011-03-20 15:20:47 EDT (Sun, 20 Mar 2011)
@@ -0,0 +1,21 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2011.
+// Distributed under the Boost
+// Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
+// copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/enums for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#include <boost/enums/pp/enumerator_definition.hpp>
+
+
+enum Ex {
+ BOOST_ENUMS_ENUMERATOR_DEFINITION_CPP_ENUMERATOR_DEFINITION((E0)(3)),
+ BOOST_ENUMS_ENUMERATOR_DEFINITION_CPP_ENUMERATOR_DEFINITION((E1)),
+ BOOST_ENUMS_ENUMERATOR_DEFINITION_CPP_ENUMERATOR_DEFINITION((E2)(7)(e2))
+};
+
Added: sandbox/enums/libs/enums/test/pp/enumerator_list.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/enums/libs/enums/test/pp/enumerator_list.pass.cpp 2011-03-20 15:20:47 EDT (Sun, 20 Mar 2011)
@@ -0,0 +1,26 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2011.
+// Distributed under the Boost
+// Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
+// copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/enums for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#include <boost/enums/pp/enumerator_definition.hpp>
+#include <boost/enums/pp/enumerator_list.hpp>
+
+#define MySeq ( (E0)(3) ) ( (E1) ) ( (E2)(7)(e2) )
+
+enum Ex {
+
+ BOOST_ENUMS_ENUMERATOR_LIST_GENERATE(
+ ( (Green)(0) )
+ ( (Orange) )
+ ( (Red)(2)("Rojo") )
+ )
+};
+
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk