Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r70229 - sandbox/enums/boost/enums/pp
From: vicente.botet_at_[hidden]
Date: 2011-03-20 16:20:36


Author: viboes
Date: 2011-03-20 16:20:35 EDT (Sun, 20 Mar 2011)
New Revision: 70229
URL: http://svn.boost.org/trac/boost/changeset/70229

Log:
Enums: Added PP Seq macros doc
Text files modified:
   sandbox/enums/boost/enums/pp/enum_declaration.hpp | 221 ++++++++++++++++++++++++++++++++++-----
   sandbox/enums/boost/enums/pp/namespaces.hpp | 106 ++++++++++++++++--
   2 files changed, 282 insertions(+), 45 deletions(-)

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-03-20 16:20:35 EDT (Sun, 20 Mar 2011)
@@ -30,63 +30,140 @@
 
 /**
  
- @brief Generates a enumerator_list from a ENUMERATOR_DEFINITION.
+ @brief Generates a @c boost::enums::meta::size specialization.
+
+ <b>Warning</b>: This macro is presented here for exposition only reasons and is not part of the interface.
  
  <b>Parameters</b>:
- - EL, the ENUMERATOR_LIST
+ - NS_EC, the @p NAMESPACES_CLASS sequence
+ - EL, the @p ENUMERATOR_LIST sequence
 
  <b>Result</b>:
  @code
- ID(EL[0]) [= VAL(EL[0])], ...,ID(ED[L]) [= VAL(ED[L])]
+ template <>
+ struct size<BOOST_ENUMS_NAMESPACES_CLASS_QNAME(NS_EC)>
+ {
+ static const std::size_t value = BOOST_PP_SEQ_SIZE(EL);
+ };
  @endcode
-
 
  */
 
-#define BOOST_ENUMS_ENUM_DCL_SIZE_SPE(NS_EC, EL) \
+#define BOOST_ENUMS_ENUM_DCL_SIZE_SPE(NS_EC, EL) \
   template <> \
- struct size<BOOST_ENUMS_NAMESPACES_CLASS_QNAME(NS_EC)> \
+ struct size<BOOST_ENUMS_NAMESPACES_CLASS_QNAME(NS_EC)> \
   { \
     static const std::size_t value; \
   }; \
   const std::size_t \
- size<BOOST_ENUMS_NAMESPACES_CLASS_QNAME(NS_EC)>::value = \
+ size<BOOST_ENUMS_NAMESPACES_CLASS_QNAME(NS_EC)>::value = \
     BOOST_PP_SEQ_SIZE(EL);
 
+/**
+
+ @brief Generates a @c boost::enums::meta::pos/val specialization.
+
+ <b>Warning</b>: This macro is presented here for exposition only reasons and is not part of the interface.
+
+ <b>Parameters</b>:
+ - P: the position in the ENUMERATOR_LIST sequence
+ - QNAME, the @p NAMESPACES_CLASS qualified name
+ - ED, the ENUMERATOR_DEFINITION sequence
+
+ <b>Result</b>:
+ @code
+ template <>
+ struct pos<QNAME, QNAME :: BOOST_ENUMS_ENUMERATOR_DEFINITION_ID(ED)>
+ {
+ BOOST_STATIC_CONSTEXPR std::size_t value = P;
+ };
+ template <>
+ struct val<QNAME, P>
+ {
+ BOOST_STATIC_CONSTEXPR
+ boost::enums::native_type<QNAME>::type value =
+ QNAME::BOOST_ENUMS_ENUMERATOR_DEFINITION_ID(ED);
+ };
+
+ @endcode
+
+ */
 
-#define BOOST_ENUMS_ENUM_DCL_POS_VAL_SPE(r, data, elem) \
-template <> \
-struct pos<data, data :: BOOST_ENUMS_ENUMERATOR_DEFINITION_ID(elem)> \
-{ \
-BOOST_STATIC_CONSTEXPR std::size_t value = r; \
-}; \
-template <> \
-struct val<data, r> \
-{ \
-BOOST_STATIC_CONSTEXPR \
-boost::enums::native_type<data>::type value = \
-data::BOOST_ENUMS_ENUMERATOR_DEFINITION_ID(elem); \
-};
-
-
+#define BOOST_ENUMS_ENUM_DCL_POS_VAL_SPE(P, QNAME, ED) \
+ template <> \
+ struct pos<QNAME, QNAME :: BOOST_ENUMS_ENUMERATOR_DEFINITION_ID(ED)> \
+ { \
+ BOOST_STATIC_CONSTEXPR std::size_t value = P; \
+ }; \
+ template <> \
+ struct val<QNAME, P> \
+ { \
+ BOOST_STATIC_CONSTEXPR \
+ boost::enums::native_type<QNAME>::type value = \
+ QNAME::BOOST_ENUMS_ENUMERATOR_DEFINITION_ID(ED); \
+ };
 
-#if 0
-#endif
+/**
+
+ @brief Generates the enum_trait specialization.
+
+ <b>Warning</b>: This macro is presented here for exposition only reasons and is not part of the interface.
+
+ <b>Parameters</b>:
+ - NS_EC, the NAMESPACES_CLASS sequence
+ - TRAITER: the enum traiter template class
+ <b>Result</b>:
+ @code
+ template <>
+ struct enum_traits<BOOST_ENUMS_NAMESPACES_CLASS_QNAME(NS_EC)>
+ : TRAITER<BOOST_ENUMS_NAMESPACES_CLASS_QNAME(NS_EC)>
+ {};
+ @endcode
+
+ */
 
 #define BOOST_ENUMS_ENUM_DCL_TRAITS_SPE(NS_EC, TRAITER) \
   template <> \
- struct enum_traits<BOOST_ENUMS_NAMESPACES_CLASS_QNAME(NS_EC)> \
- : TRAITER<BOOST_ENUMS_NAMESPACES_CLASS_QNAME(NS_EC)> \
+ struct enum_traits<BOOST_ENUMS_NAMESPACES_CLASS_QNAME(NS_EC)> \
+ : TRAITER<BOOST_ENUMS_NAMESPACES_CLASS_QNAME(NS_EC)> \
   {};
 
-#define BOOST_ENUMS_ENUM_DCL_SPE(NS_EC, EL, TRAITER) \
+/**
+
+ @brief Generates all the needed specialization associated to an ordinal scoped enum.
+
+ <b>Warning</b>: This macro is presented here for exposition only reasons and is not part of the interface.
+
+ <b>Parameters</b>:
+ - NS_EC, the NAMESPACES_CLASS sequence
+ - TRAITER: the enum traiter template class
+ <b>Result</b>:
+ @code
+ namespace boost {
+ namespace enums {
+ namespace meta {
+ BOOST_ENUMS_ENUM_DCL_SIZE_SPE(NS_EC, EL)
+ BOOST_PP_SEQ_FOR_EACH(
+ BOOST_ENUMS_ENUM_DCL_POS_VAL_SPE,
+ BOOST_ENUMS_NAMESPACES_CLASS_QNAME(NS_EC),
+ EL
+ )
+ BOOST_ENUMS_ENUM_DCL_TRAITS_SPE(NS_EC, TRAITER)
+ }
+ }
+ }
+ @endcode
+
+ */
+
+#define BOOST_ENUMS_ENUM_DCL_SPE(NS_EC, EL, TRAITER) \
   namespace boost { \
     namespace enums { \
       namespace meta { \
         BOOST_ENUMS_ENUM_DCL_SIZE_SPE(NS_EC, EL) \
- BOOST_PP_SEQ_FOR_EACH( \
+ BOOST_PP_SEQ_FOR_EACH( \
           BOOST_ENUMS_ENUM_DCL_POS_VAL_SPE, \
- BOOST_ENUMS_NAMESPACES_CLASS_QNAME(NS_EC), \
+ BOOST_ENUMS_NAMESPACES_CLASS_QNAME(NS_EC), \
           EL \
         ) \
         BOOST_ENUMS_ENUM_DCL_TRAITS_SPE(NS_EC, TRAITER) \
@@ -94,6 +171,27 @@
     } \
   }
 
+/**
+
+ @brief Generates all the needed definition associated to an ordinal scoped enum type with string conversions and constructors.
+
+ <b>Parameters</b>:
+ - NS_EC: the NAMESPACES_CLASS sequence
+ - UT: the underlying type
+ - EL: the ENUMERATOR_LIST sequence
+ - TRAITER: the enum traiter template class
+
+ <b>Result</b>:
+ @code
+ BOOST_ENUM_NS_TYPE_START(NS_EC, UT)
+ {
+ BOOST_ENUMS_ENUMERATOR_LIST_GENERATE(EL)
+ }
+ BOOST_ENUM_NS_TYPE_CONS_END(NS_EC, UT)
+ BOOST_ENUMS_ENUM_DCL_SPE(NS_EC, EL, TRAITER)
+ @endcode
+
+ */
 
 #define BOOST_ENUMS_ENUM_TYPE_DCL_CONS(NS_EC, UT, EL, TRAITER) \
   BOOST_ENUM_NS_TYPE_START(NS_EC, UT) \
@@ -103,6 +201,27 @@
   BOOST_ENUM_NS_TYPE_CONS_END(NS_EC, UT) \
   BOOST_ENUMS_ENUM_DCL_SPE(NS_EC, EL, TRAITER)
 
+/**
+
+ @brief Generates all the needed definition associated to an ordinal scoped enum type with string conversions and without constructors.
+
+ <b>Parameters</b>:
+ - NS_EC: the NAMESPACES_CLASS sequence
+ - UT: the underlying type
+ - EL: the ENUMERATOR_LIST sequence
+ - TRAITER: the enum traiter template class
+
+ <b>Result</b>:
+ @code
+ BOOST_ENUM_NS_TYPE_START(NS_EC, UT)
+ {
+ 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)
+ @endcode
+
+ */
 #define BOOST_ENUMS_ENUM_TYPE_DCL_NO_CONS(NS_EC, UT, EL, TRAITER) \
   BOOST_ENUM_NS_TYPE_START(NS_EC, UT) \
   { \
@@ -111,6 +230,28 @@
   BOOST_ENUM_NS_TYPE_NO_CONS_END(NS_EC, UT) \
   BOOST_ENUMS_ENUM_DCL_SPE(NS_EC, EL, TRAITER)
 
+/**
+
+ @brief Generates all the needed definition associated to an ordinal scoped enum class with string conversions and with constructors.
+
+ <b>Parameters</b>:
+ - NS_EC: the NAMESPACES_CLASS sequence
+ - UT: the underlying type
+ - EL: the ENUMERATOR_LIST sequence
+ - TRAITER: the enum traiter template class
+
+ <b>Result</b>:
+ @code
+ BOOST_ENUM_NS_CLASS_START(NS_EC, UT)
+ {
+ BOOST_ENUMS_ENUMERATOR_LIST_GENERATE(EL)
+ }
+ BOOST_ENUM_NS_CLASS_CONS_END(NS_EC, UT)
+ BOOST_ENUMS_ENUM_DCL_SPE(NS_EC, EL, TRAITER)
+ @endcode
+
+ */
+
 #define BOOST_ENUMS_ENUM_CLASS_DCL_CONS(NS_EC, UT, EL, TRAITER) \
   BOOST_ENUM_NS_CLASS_START(NS_EC, UT) \
   { \
@@ -119,6 +260,28 @@
   BOOST_ENUM_NS_CLASS_CONS_END(NS_EC, UT) \
   BOOST_ENUMS_ENUM_DCL_SPE(NS_EC, EL, TRAITER)
 
+/**
+
+ @brief Generates all the needed definition associated to an ordinal scoped enum class with string conversions and without constructors.
+
+ <b>Parameters</b>:
+ - NS_EC: the NAMESPACES_CLASS sequence
+ - UT: the underlying type
+ - EL: the ENUMERATOR_LIST sequence
+ - TRAITER: the enum traiter template class
+
+ <b>Result</b>:
+ @code
+ BOOST_ENUM_NS_CLASS_START(NS_EC, UT)
+ {
+ BOOST_ENUMS_ENUMERATOR_LIST_GENERATE(EL)
+ }
+ BOOST_ENUM_NS_CLASS_NO_CONS_END(NS_EC, UT)
+ BOOST_ENUMS_ENUM_DCL_SPE(NS_EC, EL, TRAITER)
+ @endcode
+
+ */
+
 #define BOOST_ENUMS_ENUM_CLASS_DCL_NO_CONS(NS_EC, UT, EL, TRAITER) \
   BOOST_ENUM_NS_CLASS_START(NS_EC, UT) \
   { \

Modified: sandbox/enums/boost/enums/pp/namespaces.hpp
==============================================================================
--- sandbox/enums/boost/enums/pp/namespaces.hpp (original)
+++ sandbox/enums/boost/enums/pp/namespaces.hpp 2011-03-20 16:20:35 EDT (Sun, 20 Mar 2011)
@@ -10,6 +10,33 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
+/** @file
+
+
+ @brief NAMESPACES, NAMESPACES_CLASS data types and macros.
+
+ @details
+
+
+ A NAMESPACES is a variable sequence of namespace identifiers.
+
+ <b>Example</b>:
+ @code
+ (NS1)(NS2)
+ @endcode
+
+ A NAMESPACES_CLASS is a variable sequence of namespace identifiers followed by a class identifier.
+
+ <b>Example</b>:
+ @code
+ (NS1)(NS2)(ENUM)
+ @endcode
+
+ All the operations are named BOOST_ENUMS_NAMESAPCES_ or BOOST_ENUMS_NAMESAPCES_CLASS.
+
+ */
+
+
 #ifndef BOOST_ENUMS_PP_NAMESPACES_HPP
 #define BOOST_ENUMS_PP_NAMESPACES_HPP
 
@@ -20,39 +47,75 @@
 //#include <boost/preprocessor.hpp>
 
 
-// (NS1) ... (NSn) (ENUM)
-// ==>
-// (NS1) ... (NSn)
+/**
+
+ @brief Get the NAMESPACES part of a NAMESPACES_CLASS.
+
+ <b>Parameters</b>:
+ - SEQ: the NAMESPACES_CLASS
+
+ <b>Result</b>: the NAMESPACES part.
+
+ */
+
 
 #define BOOST_ENUMS_NAMESPACES_CLASS_NS(SEQ) \
   BOOST_PP_SEQ_POP_BACK(SEQ)
 
+/**
+
+ @brief Get the CLASS part of a NAMESPACES_CLASS.
+
+ <b>Parameters</b>:
+ - SEQ: the NAMESPACES_CLASS
+
+ <b>Result</b>: the CLASS part.
+
+ */
 
-// (NS1) ... (NSn) (ENUM)
-// ==>
-// ENUM
 
 #define BOOST_ENUMS_NAMESPACES_CLASS_ENUM(SEQ) \
   BOOST_PP_SEQ_ELEM(BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(SEQ)), SEQ)
 
-// (NS1) ... (NSn)
-// ==>
-// namespace NS1 { ... namespace NSn {
+/**
+
+ @brief Generate the opening of the namespaces in NAMESPACES.
+
+ <b>Parameters</b>:
+ - SEQ: the NAMESPACES sequence
+
+ <b>Result</b>:
+ @code
+ namespace NS1 { ... namespace NSn {
+ @endcode
+ */
+
 
+#ifndef BOOST_ENUMS_DOXYGEN_INVOKED
 #define BOOST_ENUMS_NAMESPACES_OPEN_(r, data, elem) namespace elem {
+#endif
 
 #define BOOST_ENUMS_NAMESPACES_OPEN(SEQ) \
   BOOST_PP_SEQ_FOR_EACH(BOOST_ENUMS_NAMESPACES_OPEN_, ~, SEQ)
 
-
-// (NS1) ... (NSn)
-// ==>
-// } ... }
+/**
+
+ @brief Generate the closing of the namespaces in NAMESPACES.
+
+ <b>Parameters</b>:
+ - SEQ: the NAMESPACES sequence
+
+ <b>Result</b>:
+ @code
+ } ... }
+ @endcode
+ */
 
 #define BOOST_ENUMS_NAMESPACES_CLOSE_(r, data, elem) }
 #define BOOST_ENUMS_NAMESPACES_CLOSE(SEQ) \
   BOOST_PP_SEQ_FOR_EACH(BOOST_ENUMS_NAMESPACES_CLOSE_, ~, SEQ)
 
+#ifndef BOOST_ENUMS_DOXYGEN_INVOKED
 // (NS1) ... (NSn)
 // ==>
 // NS1::...NSn::
@@ -61,9 +124,20 @@
 #define BOOST_ENUMS_NAMESPACES_CLASS_QNAME_PRE(SEQ) \
   BOOST_PP_SEQ_FOR_EACH(BOOST_ENUMS_NAMESPACES_CLASS_QNAME_PRE_, ~, SEQ)
 
-// (NS1) ... (NSn) (ENUM)
-// ==>
-// NS1::...NSn::ENUM
+#endif
+
+/**
+
+ @brief the qualified name associated to NAMESPACES_CLASS.
+
+ <b>Parameters</b>:
+ - SEQ: the NAMESPACES_CLASS sequence
+
+ <b>Result</b>:
+ @code
+ NS1::...NSn::ENUM
+ @endcode
+ */
 
 #define BOOST_ENUMS_NAMESPACES_CLASS_QNAME(SEQ) \
   BOOST_ENUMS_NAMESPACES_CLASS_QNAME_PRE(BOOST_ENUMS_NAMESPACES_CLASS_NS(SEQ)) BOOST_ENUMS_NAMESPACES_CLASS_ENUM(SEQ)


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