Boost logo

Boost-Commit :

From: oryol_at_[hidden]
Date: 2008-07-31 14:13:37


Author: jeremypack
Date: 2008-07-31 14:13:37 EDT (Thu, 31 Jul 2008)
New Revision: 47918
URL: http://svn.boost.org/trac/boost/changeset/47918

Log:
Update extension headers for doxygen.
Removed:
   sandbox/boost/extension/functor.hpp
Text files modified:
   sandbox/boost/extension/type_map.hpp | 37 ++++++++++++++++++++++++++++++++++++-
   1 files changed, 36 insertions(+), 1 deletions(-)

Deleted: sandbox/boost/extension/functor.hpp
==============================================================================
--- sandbox/boost/extension/functor.hpp 2008-07-31 14:13:37 EDT (Thu, 31 Jul 2008)
+++ (empty file)
@@ -1,82 +0,0 @@
-/*
- * Boost.Extension / functor:
- * functor used as the exported function of the libraries (the one that
- * registers the implementations at library loading time)
- *
- * (C) Copyright Jeremy Pack 2008
- * 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/ for latest version.
- */
-
-#ifndef BOOST_PP_IS_ITERATING
-
-
-
-#ifndef BOOST_EXTENSION_FUNCTOR_HPP
-#define BOOST_EXTENSION_FUNCTOR_HPP
-
-#include <boost/extension/common.hpp>
-#include <boost/extension/impl/library_impl.hpp>
-
-
-
-namespace boost { namespace extensions {
-
-//using boost::extensions::detail::generic_function_ptr;
-
-
-/// Declaration of functor class template.
-template <class ReturnValue,
- BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT( \
- BOOST_PP_INC(BOOST_EXTENSION_MAX_FUNCTOR_PARAMS), class Param, void) >
- class functor;
-
-/// Functor template specializations.
-# define BOOST_PP_ITERATION_LIMITS (0, BOOST_PP_INC(BOOST_EXTENSION_MAX_FUNCTOR_PARAMS) - 1)
-# define BOOST_PP_FILENAME_1 <boost/extension/functor.hpp> // this file
-# include BOOST_PP_ITERATE()
-
-
-
-}} // namespace boost::extensions
-
-#endif // BOOST_EXTENSION_FUNCTOR_HPP
-
-
-
-#else // BOOST_PP_IS_ITERATING
-
-
-
-
-# define n BOOST_PP_ITERATION()
-
-template <class ReturnValue
- BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, class Param) >
-class functor<ReturnValue
- BOOST_PP_COMMA_IF(n) BOOST_PP_ENUM_PARAMS(n, Param) >
-{
-private:
-
- typedef ReturnValue (*FunctionType)(BOOST_PP_ENUM_PARAMS(n, Param));
- FunctionType func_;
-
-public:
-
- bool is_valid() const { return func_ != 0; }
-
- explicit functor(FunctionType func) : func_(func) {}
-
- explicit functor(generic_function_ptr func) : func_(FunctionType(func)) {}
-
- ReturnValue operator()(BOOST_PP_ENUM_BINARY_PARAMS(n, Param, p)) {
- return func_(BOOST_PP_ENUM_PARAMS(n, p));
- }
-};
-
-# undef n
-
-#endif // BOOST_PP_IS_ITERATING

Modified: sandbox/boost/extension/type_map.hpp
==============================================================================
--- sandbox/boost/extension/type_map.hpp (original)
+++ sandbox/boost/extension/type_map.hpp 2008-07-31 14:13:37 EDT (Thu, 31 Jul 2008)
@@ -23,10 +23,31 @@
   * \tparam TypeInfo The type used for TypeInfo. By default,
   * RTTI is used, but users can define their own TypeInfo.
   * See impl/typeinfo.hpp.
+ *
+ * The `type_map` class is used for holding an arbitrary collection
+ * of types - no more than one of each type.
+ * In general, standard usage is as follows:
+ *
+ * \code
+ * type_map types;
+ * // This will add an integer to the type_map, or retrieve
+ * // one if it already exists.
+ * int& first_int(types.get());
+ * first_int = 5;
+ * // This will make second_int point to the same value
+ * // as first_int.
+ * int& second_int(types.get());
+ * second_int = 10;
+ * // Now first_int is 10.
+ * // It is also possible to use arbitrary types in the map,
+ * // as long as they are default constructible.
+ * std::set<std::string>& my_string(types.get());
+ * \endcode
   */
 template <class TypeInfo>
 class basic_type_map {
 public:
+#ifndef BOOST_EXTENSION_DOXYGEN_INVOKED
   class type_map_convertible {
   public:
     ~type_map_convertible() {
@@ -66,7 +87,21 @@
   type_map_convertible& get() {
     return convertible_;
   }
-
+#endif
+ /** \brief Retrieve a given type from the type_map.
+ *
+ * This is the only method users should ever need to use.
+ * By calling it with a template argument `Type`, a reference
+ * to the single object of that type will be returned, after
+ * being created if necessary.
+ * It is possible to omit the template parameter if it is clear
+ * from context:
+ * \code
+ * type_map types;
+ * int& my_int(types.get());
+ * \endcode
+ * \tparam Type The type of the object to return a reference to.
+ */
   template <class Type>
   Type& get() {
     return convertible_;


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