|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r72251 - in sandbox/enums/boost/enums: ordinal pp scoped
From: vicente.botet_at_[hidden]
Date: 2011-05-28 16:09:41
Author: viboes
Date: 2011-05-28 16:09:41 EDT (Sat, 28 May 2011)
New Revision: 72251
URL: http://svn.boost.org/trac/boost/changeset/72251
Log:
Enums: Update some comments+Adapt to ne conversion namespace
Text files modified:
sandbox/enums/boost/enums/ordinal/linear_traiter.hpp | 4 ++--
sandbox/enums/boost/enums/ordinal/val.hpp | 3 ++-
sandbox/enums/boost/enums/pp/enum_declaration.hpp | 37 ++++++++++++++++++++++++++++++++++---
sandbox/enums/boost/enums/scoped/enum_class_cons.hpp | 9 +++++----
sandbox/enums/boost/enums/scoped/enum_class_no_cons.hpp | 12 ++++++------
sandbox/enums/boost/enums/scoped/underlying_value.hpp | 2 +-
6 files changed, 50 insertions(+), 17 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-05-28 16:09:41 EDT (Sat, 28 May 2011)
@@ -64,7 +64,7 @@
static EC val(std::size_t p)
{
typename underlying_type<EC>::type uv = p*step+first_value;
- return boost::convert_to<EC>(uv);
+ return boost::conversion::convert_to<EC>(uv);
}
};
@@ -81,7 +81,7 @@
// static EC val(std::size_t i)
// {
// typename underlying_type<EC>::type ut = 1<<i;
-// return boost::convert_to<EC>(ut);
+// return boost::conversion::convert_to<EC>(ut);
// }
// };
}
Modified: sandbox/enums/boost/enums/ordinal/val.hpp
==============================================================================
--- sandbox/enums/boost/enums/ordinal/val.hpp (original)
+++ sandbox/enums/boost/enums/ordinal/val.hpp 2011-05-28 16:09:41 EDT (Sat, 28 May 2011)
@@ -22,6 +22,7 @@
#include <boost/enums/ordinal/traits.hpp>
#include <boost/enums/ordinal/size.hpp>
+#include <boost/enums/scoped/native_type.hpp>
#include <boost/assert.hpp>
#include <cstddef>
@@ -43,7 +44,7 @@
{
//! The nested @c value to be defined for each scoped enum
//! specialization.
- constexpr typename native_type<EC>::type value=<to be defined for each specialization>;
+ constexpr typename native_type<EC>::type value;
};
#endif
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-05-28 16:09:41 EDT (Sat, 28 May 2011)
@@ -34,7 +34,7 @@
BOOST_ENUMS_ENUMERATOR_DEFINITION_STR(ED) \
) == 0) \
{ \
- return boost::convert_to<ENUM>( \
+ return boost::conversion::convert_to<ENUM>( \
ENUM::BOOST_ENUMS_ENUMERATOR_DEFINITION_ID(ED) \
); \
}
@@ -66,7 +66,7 @@
boost::dummy::type_tag<ENUM> const& \
) \
{ \
- return boost::convert_to<ENUM>( \
+ return boost::conversion::convert_to<ENUM>( \
str.c_str() \
); \
} \
@@ -281,6 +281,37 @@
@Param{TRAITER,the enum traiter template class}
@Result
+ @cond
+ BOOST_ENUMS_ENUM_TYPE_DCL_NO_CONS((NS1)...(NSk)(EC), UT, ((E1))...((En)), TRAITER)
+
+ namespace NS1 {
+ ...
+ namespace NSk {
+
+ class EC {
+ public:
+ enum type { E1, ... En };
+ typedef UT underlying_type;
+ private:
+ underlying_type val_;
+ public:
+ operator type() { return type(val_); }
+ EC& operator =(type rhs) {
+ val_=static_cast<underlying_type>(rhs);
+ return *this;
+ }
+ static EC default_value() {
+ EC res;
+ res.val_=static_cast<underlying_type>(EC::type());
+ return res;
+ }
+ type native_value() const { return type(val_); }
+ underlying_type underlying_value() const { return val_; }
+ };
+ } // NSk
+ ...
+ } // NS1
+ @endcond
@code
BOOST_ENUM_NS_TYPE_START(NS_EC, UT)
{
@@ -297,7 +328,7 @@
BOOST_ENUMS_ENUMERATOR_LIST_GENERATE(EL) \
} \
BOOST_ENUM_NS_TYPE_NO_CONS_END(NS_EC, UT) \
- BOOST_ENUMS_ENUM_DCL_SPE(NS_EC, EL, TRAITER) \
+ BOOST_ENUMS_ENUM_DCL_SPE(NS_EC, EL, TRAITER) \
BOOST_ENUMS_NAMESPACES_OPEN(BOOST_ENUMS_NAMESPACES_CLASS_NS(NS_EC)) \
BOOST_ENUMS_DCL_STRING_CONVERSIONS(BOOST_ENUMS_NAMESPACES_CLASS_ENUM(NS_EC), EL) \
BOOST_ENUMS_NAMESPACES_CLOSE(BOOST_ENUMS_NAMESPACES_CLASS_NS(NS_EC))
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-05-28 16:09:41 EDT (Sat, 28 May 2011)
@@ -16,8 +16,8 @@
The header \c <boost/enums/scoped/enum_class_cons.hpp> defines the declaration of enum_class_cons<> template class.
*/
-#ifndef BOOST_ENUMS_SCOPED_ENUM_TYPE_CONS_HPP
-#define BOOST_ENUMS_SCOPED_ENUM_TYPE_CONS_HPP
+#ifndef BOOST_ENUMS_SCOPED_ENUM_CLASS_CONS_HPP
+#define BOOST_ENUMS_SCOPED_ENUM_CLASS_CONS_HPP
#include <boost/config.hpp>
#include <boost/conversion/convert_to.hpp>
@@ -235,7 +235,8 @@
{
return lhs.val_ > rhs;
}
- //! conversions from enum_type_cons to underlying_type following the Boost.Conversion protocol
+
+ //! conversions from enum_class_cons to underlying_type following the Boost.Conversion protocol
//! @Returns <tt>boost::enums::underlying_value(v)</tt>.
friend underlying_type convert_to(enum_class_cons v,
@@ -244,7 +245,7 @@
return boost::enums::underlying_value(v);
}
- //! conversions from enum_type_cons to type following the Boost.Conversion protocol
+ //! conversions from enum_class_cons to type following the Boost.Conversion protocol
//! @Returns <tt>boost::enums::native_value(v)</tt>.
friend type convert_to(enum_class_cons v,
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-05-28 16:09:41 EDT (Sat, 28 May 2011)
@@ -16,8 +16,8 @@
The header \c <boost/enums/scoped/enum_class_no_cons.hpp> defines the declaration of enum_class_no_cons<> template class.
*/
-#ifndef BOOST_ENUMS_SCOPED_ENUM_TYPE_NO_CONS_HPP
-#define BOOST_ENUMS_SCOPED_ENUM_TYPE_NO_CONS_HPP
+#ifndef BOOST_ENUMS_SCOPED_ENUM_CLASS_NO_CONS_HPP
+#define BOOST_ENUMS_SCOPED_ENUM_CLASS_NO_CONS_HPP
#include <boost/config.hpp>
#include <boost/conversion/convert_to.hpp>
@@ -186,7 +186,7 @@
return lhs.val_ > rhs;
}
- //! conversions from underlying_type to enum_type_cons following the Boost.Conversion protocol
+ //! conversions from underlying_type to enum_class_no_cons following the Boost.Conversion protocol
friend enum_class_no_cons convert_to(underlying_type v,
boost::dummy::type_tag<enum_class_no_cons> const&)
{
@@ -195,7 +195,7 @@
return res;
}
- //! friend conversions from type to enum_type_cons following the Boost.Conversion protocol
+ //! friend conversions from type to enum_class_no_cons following the Boost.Conversion protocol
friend enum_class_no_cons convert_to(type v,
boost::dummy::type_tag<enum_class_no_cons> const&)
{
@@ -204,14 +204,14 @@
return res;
}
- //! conversions from enum_type_cons to underlying_type following the Boost.Conversion protocol
+ //! conversions from enum_class_no_cons to underlying_type following the Boost.Conversion protocol
friend underlying_type convert_to(enum_class_no_cons v,
boost::dummy::type_tag<underlying_type> const&)
{
return boost::enums::underlying_value(v);
}
- //! conversions from enum_type_cons to type following the Boost.Conversion protocol
+ //! conversions from enum_class_no_cons to type following the Boost.Conversion protocol
friend type convert_to(enum_class_no_cons v,
boost::dummy::type_tag<type> const&)
{
Modified: sandbox/enums/boost/enums/scoped/underlying_value.hpp
==============================================================================
--- sandbox/enums/boost/enums/scoped/underlying_value.hpp (original)
+++ sandbox/enums/boost/enums/scoped/underlying_value.hpp 2011-05-28 16:09:41 EDT (Sat, 28 May 2011)
@@ -14,7 +14,7 @@
#define BOOST_ENUMS_SCOPED_UNDERLYING_VALUE_HPP
#include <boost/config.hpp>
-#include <boost/enums/scoped/native_type.hpp>
+#include <boost/enums/scoped/underlying_type.hpp>
namespace boost {
namespace enums {
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