// // option_set.hpp // ~~~~~~~~~~~~~~ // // Copyright (c) 2009-2013 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // path LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // #ifndef URDL_OPTION_SET_HPP #define URDL_OPTION_SET_HPP #include #include "urdl/detail/config.hpp" #include "urdl/detail/scoped_ptr.hpp" #include "urdl/detail/abi_prefix.hpp" namespace urdl { /// The class @c option_set maintains a collection of options. /** * @par Remarks * Options are uniquely identified by type, so the @c option_set class is a * collection of objects of differing types, indexed by type. * * The option types stored in the set must meet the type requirements for * CopyConstructible. * * @par Requirements * @e Header: @c @n * @e Namespace: @c urdl */ class option_set { public: /// Constructs an object of class @c option_set. /** * @par Remarks * Creates an empty set. Any option queried using the @c get_option member * function will return the default value of the option. */ URDL_DECL option_set(); /// Constructs an object of class @c option_set. /** * @par Remarks * Creates an identical copy of another set. Any option queried using the * @c get_option member function will return the same value for both sets. */ URDL_DECL option_set(const option_set& other); /// Destroys an object of class @c option_set. URDL_DECL ~option_set(); /// Assignment operator. /** * @par Remarks * Creates an identical copy of another set. Any option queried using the * @c get_option member function will return the same value for both sets. */ URDL_DECL option_set& operator=(const option_set& other); /// Sets the value of an option in the set. /** * @param o The option to be set. * * @par Remarks * If the type @c Option is already present in the set, first removes that * element. Adds the option to the set. */ template void set_option(const Option& o) { set_option_wrapper_base(new option_wrapper