|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r74035 - in sandbox/enums/boost/enums: . ordinal pp scoped
From: vicente.botet_at_[hidden]
Date: 2011-08-23 19:51:24
Author: viboes
Date: 2011-08-23 19:51:23 EDT (Tue, 23 Aug 2011)
New Revision: 74035
URL: http://svn.boost.org/trac/boost/changeset/74035
Log:
Enums: make it work without Boost.Conversion
Text files modified:
sandbox/enums/boost/enums/ordinal/linear_traiter.hpp | 7 ++++---
sandbox/enums/boost/enums/pp/enum_declaration.hpp | 24 ++++++++++++++++++++++--
sandbox/enums/boost/enums/scoped.hpp | 8 ++++----
sandbox/enums/boost/enums/scoped/emulation.hpp | 13 ++++++++++++-
sandbox/enums/boost/enums/scoped/enum_class_cons.hpp | 2 +-
sandbox/enums/boost/enums/scoped/enum_class_no_cons.hpp | 1 +
sandbox/enums/boost/enums/scoped/enum_type_cons.hpp | 1 +
sandbox/enums/boost/enums/scoped/enum_type_no_cons.hpp | 1 +
8 files changed, 46 insertions(+), 11 deletions(-)
Modified: sandbox/enums/boost/enums/ordinal/linear_traiter.hpp
==============================================================================
--- sandbox/enums/boost/enums/ordinal/linear_traiter.hpp (original)
+++ sandbox/enums/boost/enums/ordinal/linear_traiter.hpp 2011-08-23 19:51:23 EDT (Tue, 23 Aug 2011)
@@ -19,8 +19,9 @@
#include <boost/enums/ordinal/pos.hpp>
#include <boost/enums/ordinal/first.hpp>
#include <boost/enums/ordinal/last.hpp>
+#ifndef BOOST_ENUMS_NOT_DEPENDS_ON_CONVERSION
#include <boost/conversion/explicit_convert_to.hpp>
-
+#endif
/*!
@file
@brief
@@ -64,7 +65,7 @@
static EC val(std::size_t p)
{
typename underlying_type<EC>::type uv = p*step+first_value;
- return boost::conversion::explicit_convert_to<EC>(uv);
+ return EC(uv);
}
};
@@ -81,7 +82,7 @@
// static EC val(std::size_t i)
// {
// typename underlying_type<EC>::type ut = 1<<i;
-// return boost::conversion::explicit_convert_to<EC>(ut);
+// return EC(ut);
// }
// };
}
Modified: sandbox/enums/boost/enums/pp/enum_declaration.hpp
==============================================================================
--- sandbox/enums/boost/enums/pp/enum_declaration.hpp (original)
+++ sandbox/enums/boost/enums/pp/enum_declaration.hpp 2011-08-23 19:51:23 EDT (Tue, 23 Aug 2011)
@@ -33,7 +33,7 @@
BOOST_ENUMS_ENUMERATOR_DEFINITION_STR(ED) \
) == 0) \
{ \
- return boost::conversion::explicit_convert_to<ENUM>( \
+ return ENUM( \
ENUM::BOOST_ENUMS_ENUMERATOR_DEFINITION_ID(ED) \
); \
}
@@ -43,7 +43,7 @@
BOOST_ENUMS_ENUMERATOR_DEFINITION_STR(ED) \
) \
{ \
- return boost::conversion::explicit_convert_to<ENUM>( \
+ return ENUM( \
ENUM::BOOST_ENUMS_ENUMERATOR_DEFINITION_ID(ED) \
); \
}
@@ -96,6 +96,8 @@
} \
} \
+
+#ifndef BOOST_ENUMS_NOT_DEPENDS_ON_CONVERSION
#define BOOST_ENUMS_DCL_STRING_CONVERSIONS_SPECIALIZATIONS(ENUM, EL) \
namespace boost { \
namespace conversion { \
@@ -137,6 +139,24 @@
} \
} \
+#else
+#define BOOST_ENUMS_DCL_STRING_CONVERSIONS_SPECIALIZATIONS(ENUM, EL) \
+ inline \
+ const char* c_str(ENUM e) \
+ { \
+ switch (boost::enums::native_value(e)) \
+ { \
+ BOOST_PP_SEQ_FOR_EACH( \
+ BOOST_ENUMS_ENUM_DCL_ID_TO_STR, \
+ ENUM, \
+ EL \
+ ) \
+ default: \
+ throw "invalid value for " \
+ BOOST_PP_STRINGIZE(ENUM); \
+ } \
+ }
+#endif
/**
Modified: sandbox/enums/boost/enums/scoped.hpp
==============================================================================
--- sandbox/enums/boost/enums/scoped.hpp (original)
+++ sandbox/enums/boost/enums/scoped.hpp 2011-08-23 19:51:23 EDT (Tue, 23 Aug 2011)
@@ -20,10 +20,10 @@
#define BOOST_ENUMS_SCOPED_HPP
#include <boost/enums/scoped/emulation.hpp>
-#include <boost/enums/scoped/enum_class_cons.hpp>
-#include <boost/enums/scoped/enum_class_no_cons.hpp>
-#include <boost/enums/scoped/enum_type_cons.hpp>
-#include <boost/enums/scoped/enum_type_no_cons.hpp>
+//#include <boost/enums/scoped/enum_class_cons.hpp>
+//#include <boost/enums/scoped/enum_class_no_cons.hpp>
+//#include <boost/enums/scoped/enum_type_cons.hpp>
+//#include <boost/enums/scoped/enum_type_no_cons.hpp>
#include <boost/enums/scoped/scoping_type.hpp>
#include <boost/enums/scoped/native_type.hpp>
#include <boost/enums/scoped/underlying_type.hpp>
Modified: sandbox/enums/boost/enums/scoped/emulation.hpp
==============================================================================
--- sandbox/enums/boost/enums/scoped/emulation.hpp (original)
+++ sandbox/enums/boost/enums/scoped/emulation.hpp 2011-08-23 19:51:23 EDT (Tue, 23 Aug 2011)
@@ -22,7 +22,9 @@
#include <boost/enums/scoped/native_value.hpp>
#include <boost/enums/scoped/underlying_value.hpp>
#include <boost/enums/scoped/is_enum.hpp>
+#ifndef BOOST_ENUMS_NOT_DEPENDS_ON_CONVERSION
#include <boost/conversion/explicit_convert_to.hpp>
+#endif
#include <boost/enums/pp/namespaces.hpp>
//#include <cstring>
@@ -312,10 +314,14 @@
#define BOOST_ENUMS_SPECIALIZATIONS(EC, UT) \
BOOST_ENUMS_DETAIL_UNDERLYING_TYPE_SPEC(EC, UT)
+#ifndef BOOST_ENUMS_NOT_DEPENDS_ON_CONVERSION
#define BOOST_ENUMS_OUT(NS_EC, UT) \
BOOST_ENUMS_SPECIALIZATIONS(BOOST_ENUMS_NAMESPACES_CLASS_QNAME(NS_EC), UT) \
BOOST_ENUMS_DETAIL_CONVERSIONS_SPECIALIZATIONS(BOOST_ENUMS_NAMESPACES_CLASS_QNAME(NS_EC),UT)
-
+#else
+ #define BOOST_ENUMS_OUT(NS_EC, UT) \
+ BOOST_ENUMS_SPECIALIZATIONS(BOOST_ENUMS_NAMESPACES_CLASS_QNAME(NS_EC), UT)
+#endif
#else // BOOST_NO_SCOPED_ENUMS
#define BOOST_ENUM_CLASS_START(EC, UT) \
@@ -374,9 +380,14 @@
BOOST_ENUMS_DETAIL_SCOPING_TYPE_SPEC(EC) \
BOOST_ENUMS_DETAIL_IS_ENUM_TYPE_SPEC(EC)
+#ifndef BOOST_ENUMS_NOT_DEPENDS_ON_CONVERSION
#define BOOST_ENUMS_OUT(NS_EC, UT) \
BOOST_ENUMS_SPECIALIZATIONS(BOOST_ENUMS_NAMESPACES_CLASS_QNAME(NS_EC), UT) \
BOOST_ENUMS_DETAIL_CONVERSIONS_SPECIALIZATIONS(BOOST_ENUMS_NAMESPACES_CLASS_QNAME(NS_EC),UT)
+#else
+ #define BOOST_ENUMS_OUT(NS_EC, UT) \
+ BOOST_ENUMS_SPECIALIZATIONS(BOOST_ENUMS_NAMESPACES_CLASS_QNAME(NS_EC), UT)
+#endif
#endif
#define BOOST_ENUM_NS_CLASS_START(QNAME, UT) \
Modified: sandbox/enums/boost/enums/scoped/enum_class_cons.hpp
==============================================================================
--- sandbox/enums/boost/enums/scoped/enum_class_cons.hpp (original)
+++ sandbox/enums/boost/enums/scoped/enum_class_cons.hpp 2011-08-23 19:51:23 EDT (Tue, 23 Aug 2011)
@@ -15,7 +15,7 @@
@brief
The header \c <boost/enums/scoped/enum_class_cons.hpp> defines the declaration of enum_class_cons<> template class.
*/
-
+#error
#ifndef BOOST_ENUMS_SCOPED_ENUM_CLASS_CONS_HPP
#define BOOST_ENUMS_SCOPED_ENUM_CLASS_CONS_HPP
Modified: sandbox/enums/boost/enums/scoped/enum_class_no_cons.hpp
==============================================================================
--- sandbox/enums/boost/enums/scoped/enum_class_no_cons.hpp (original)
+++ sandbox/enums/boost/enums/scoped/enum_class_no_cons.hpp 2011-08-23 19:51:23 EDT (Tue, 23 Aug 2011)
@@ -15,6 +15,7 @@
\brief
The header \c <boost/enums/scoped/enum_class_no_cons.hpp> defines the declaration of enum_class_no_cons<> template class.
*/
+#error
#ifndef BOOST_ENUMS_SCOPED_ENUM_CLASS_NO_CONS_HPP
#define BOOST_ENUMS_SCOPED_ENUM_CLASS_NO_CONS_HPP
Modified: sandbox/enums/boost/enums/scoped/enum_type_cons.hpp
==============================================================================
--- sandbox/enums/boost/enums/scoped/enum_type_cons.hpp (original)
+++ sandbox/enums/boost/enums/scoped/enum_type_cons.hpp 2011-08-23 19:51:23 EDT (Tue, 23 Aug 2011)
@@ -15,6 +15,7 @@
\brief
The header \c <boost/enums/scoped/enum_type_cons.hpp> defines the declaration of enum_type_cons<> template class.
*/
+#error
#ifndef BOOST_ENUMS_SCOPED_ENUM_TYPE_CONS_HPP
#define BOOST_ENUMS_SCOPED_ENUM_TYPE_CONS_HPP
Modified: sandbox/enums/boost/enums/scoped/enum_type_no_cons.hpp
==============================================================================
--- sandbox/enums/boost/enums/scoped/enum_type_no_cons.hpp (original)
+++ sandbox/enums/boost/enums/scoped/enum_type_no_cons.hpp 2011-08-23 19:51:23 EDT (Tue, 23 Aug 2011)
@@ -15,6 +15,7 @@
\brief
The header \c <boost/enums/scoped/enum_type_no_cons.hpp> defines the declaration of enum_type_no_cons<> template class.
*/
+#error
#ifndef BOOST_ENUMS_SCOPED_ENUM_TYPE_NO_CONS_HPP
#define BOOST_ENUMS_SCOPED_ENUM_TYPE_NO_CONS_HPP
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