[med-svn] [camp] 02/04: Imported Upstream version 0.7.1.3
Corentin Desfarges
corentin-guest at moszumanska.debian.org
Tue Jan 12 11:28:17 UTC 2016
This is an automated email from the git hooks/post-receive script.
corentin-guest pushed a commit to branch master
in repository camp.
commit a22bba7f7e6e6992670720fccef3e657bfde2a29
Author: Corentin Desfarges <corentin.desfarges.dev at gmail.com>
Date: Tue Jan 12 11:52:34 2016 +0100
Imported Upstream version 0.7.1.3
---
include/camp/arraymapper.hpp | 37 ++
include/camp/class.hpp | 744 ++++++++++++++++-----------------
include/camp/detail/classmanager.hpp | 378 ++++++++---------
include/camp/detail/enummanager.hpp | 372 ++++++++---------
include/camp/detail/getter.hpp | 2 +-
include/camp/detail/issmartpointer.hpp | 15 +-
include/camp/detail/objectholder.hpp | 2 +-
include/camp/detail/objectholder.inl | 2 +-
include/camp/enum.hpp | 460 ++++++++++----------
include/camp/userobject.hpp | 2 +-
src/classmanager.cpp | 2 +-
src/enummanager.cpp | 2 +-
test/function.hpp | 354 ++++++++--------
test/functionaccess.hpp | 130 +++---
test/inheritance.hpp | 230 +++++-----
test/mapper.hpp | 296 ++++++-------
test/propertyaccess.hpp | 148 +++----
17 files changed, 1601 insertions(+), 1575 deletions(-)
diff --git a/include/camp/arraymapper.hpp b/include/camp/arraymapper.hpp
index b0a90b7..6d6d672 100644
--- a/include/camp/arraymapper.hpp
+++ b/include/camp/arraymapper.hpp
@@ -186,6 +186,43 @@ struct ArrayMapper<boost::array<T, N> >
};
/*
+ * Specialization of ArrayMapper for std::array
+ */
+template <typename T, std::size_t N>
+struct ArrayMapper<std::array<T, N> >
+{
+ typedef T ElementType;
+
+ static bool dynamic()
+ {
+ return false;
+ }
+
+ static std::size_t size(const std::array<T, N>&)
+ {
+ return N;
+ }
+
+ static const T& get(const std::array<T, N>& arr, std::size_t index)
+ {
+ return arr[index];
+ }
+
+ static void set(std::array<T, N>& arr, std::size_t index, const T& value)
+ {
+ arr[index] = value;
+ }
+
+ static void insert(std::array<T, N>&, std::size_t, const T&)
+ {
+ }
+
+ static void remove(std::array<T, N>&, std::size_t)
+ {
+ }
+};
+
+/*
* Specialization of ArrayMapper for std::vector
*/
template <typename T>
diff --git a/include/camp/class.hpp b/include/camp/class.hpp
index 0aa6424..5d7c416 100644
--- a/include/camp/class.hpp
+++ b/include/camp/class.hpp
@@ -1,372 +1,372 @@
-/****************************************************************************
-**
-** Copyright (C) 2009-2010 TECHNOGERMA Systems France and/or its subsidiary(-ies).
-** Contact: Technogerma Systems France Information (contact at technogerma.fr)
-**
-** This file is part of the CAMP library.
-**
-** CAMP is free software: you can redistribute it and/or modify
-** it under the terms of the GNU Lesser General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** CAMP is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU Lesser General Public License for more details.
-**
-** You should have received a copy of the GNU Lesser General Public License
-** along with CAMP. If not, see <http://www.gnu.org/licenses/>.
-**
-****************************************************************************/
-
-
-#ifndef CAMP_CLASS_HPP
-#define CAMP_CLASS_HPP
-
-
-#include <camp/config.hpp>
-#include <camp/args.hpp>
-#include <camp/classget.hpp>
-#include <camp/classcast.hpp>
-#include <camp/property.hpp>
-#include <camp/function.hpp>
-#include <camp/tagholder.hpp>
-#include <camp/errors.hpp>
-#include <camp/userobject.hpp>
-#include <camp/detail/classmanager.hpp>
-#include <camp/detail/typeid.hpp>
-#include <boost/noncopyable.hpp>
-#include <boost/shared_ptr.hpp>
-#include <boost/multi_index_container.hpp>
-#include <boost/multi_index/mem_fun.hpp>
-#include <boost/multi_index/ordered_index.hpp>
-#include <boost/multi_index/random_access_index.hpp>
-#include <string>
-
-
-namespace bm = boost::multi_index;
-
-namespace camp
-{
-template <typename T> class ClassBuilder;
-class Constructor;
-class Value;
-class ClassVisitor;
-
-/**
- * \brief camp::Class represents a metaclass composed of properties and functions
- *
- * camp::Class is the main class of the CAMP API. It defines a metaclass, which
- * is an abstract representation of a C++ class with its own properties,
- * functions, constructors, base classes, etc.
- *
- * Classes are declared, bound to a C++ type and filled with the \c declare
- * template function.
- *
- * \code
- * class MyClass
- * {
- * public:
- *
- * MyClass();
- * int getProp() const;
- * void setProp(int);
- * std::string func();
- * };
- *
- * camp::Class::declare<MyClass>("MyClass")
- * .tag("help", "this is my class")
- * .constructor0()
- * .property("prop", &MyClass::getProp, &MyClass::setProp)
- * .function("func", &MyClass::func);
- * \endcode
- *
- * It then provides a set of accessors to retrieve its member functions and properties.
- *
- * \code
- * const camp::Class& metaclass = camp::classByType<MyClass>();
- *
- * const camp::Property& prop = metaclass.property("prop");
- * const camp::Function& func = metaclass.function("func");
- * \endcode
- *
- * Another way to inspect a class, which is more type-safe, is to use a ClassVisitor.
- *
- * \code
- * MyVisitor visitor;
- * metaclass.visit(visitor);
- * \endcode
- *
- * It also allows to create and destroy instances of the bound C++ class.
- *
- * \code
- * MyClass* obj = metaclass.construct<MyClass>();
- * metaclass.destroy(obj);
- * \endcode
- *
- * \remark All function and property names are unique within the metaclass.
- *
- * \sa Enum, TagHolder, ClassBuilder, Function, Property
- */
-class CAMP_API Class : public TagHolder, boost::noncopyable
-{
-public:
-
- /**
- * \brief Declare a new metaclass
- *
- * This is the function to call to create a new metaclass. The template
- * parameter T is the C++ class that will be bound to the metaclass.
- *
- * \param name Name of the metaclass in CAMP. This name identifies
- * the metaclass and thus has to be unique
- *
- * \return A ClassBuilder<T> object that will provide functions
- * to fill the new metaclass with properties, functions, etc.
- */
- template <typename T>
- static ClassBuilder<T> declare(const std::string& name);
-
-public:
-
- /**
- * \brief Return the name of the metaclass
- *
- * \return String containing the name of the metaclass
- */
- const std::string& name() const;
-
- /**
- * \brief Return the total number of base metaclasses of this metaclass
- *
- * \return Number of base metaclasses
- */
- std::size_t baseCount() const;
-
- /**
- * \brief Return a base metaclass from its index
- *
- * \param index Index of the base to get
- *
- * \return Reference to the index-th base metaclass of this metaclass
- *
- * \throw OutOfRange index is out of range
- */
- const Class& base(std::size_t index) const;
-
- /**
- * \brief Return the total number of functions of this metaclass
- *
- * \return Number of functions
- */
- std::size_t functionCount() const;
-
- /**
- * \brief Check if this metaclass contains the given function
- *
- * \param name Name of the function to check
- *
- * \return True if the function is in the metaclass, false otherwise
- */
- bool hasFunction(const std::string& name) const;
-
- /**
- * \brief Get a function from its index in this metaclass
- *
- * \param index Index of the function to get
- *
- * \return Reference to the function
- *
- * \throw OutOfRange index is out of range
- */
- const Function& function(std::size_t index) const;
-
- /**
- * \brief Get a function from its name
- *
- * \param name Name of the function to get (case sensitive)
- *
- * \return Reference to the function
- *
- * \throw FunctionNotFound \a name is not a function of the metaclass
- */
- const Function& function(const std::string& name) const;
-
- /**
- * \brief Return the total number of properties of this metaclass
- *
- * \return Number of properties
- */
- std::size_t propertyCount() const;
-
- /**
- * \brief Check if this metaclass contains the given property
- *
- * \param name Name of the property to check
- *
- * \return True if the property is in the metaclass, false otherwise
- */
- bool hasProperty(const std::string& name) const;
-
- /**
- * \brief Get a property from its index in this metaclass
- *
- * \param index Index of the property to get
- *
- * \return Reference to the property
- *
- * \throw OutOfRange index is out of range
- */
- const Property& property(std::size_t index) const;
-
- /**
- * \brief Get a property from its name
- *
- * \param name Name of the property to get (case sensitive)
- *
- * \return Reference to the property
- *
- * \throw PropertyNotFound \a name is not a property of the metaclass
- */
- const Property& property(const std::string& name) const;
-
- /**
- * \brief Construct a new instance of the C++ class bound to the metaclass
- *
- * If no constructor can match the provided arguments, UserObject::nothing
- * is returned.
- * The new instance is wrapped into a UserObject. It must be destroyed
- * with the Class::destroy function.
- *
- * \param args Arguments to pass to the constructor (empty by default)
- *
- * \return New instance wrapped into a UserObject, or UserObject::nothing if it failed
- */
- UserObject construct(const Args& args = Args::empty) const;
-
- /**
- * \brief Destroy an instance of the C++ class bound to the metaclass
- *
- * This function must be called to destroy every instance created with
- * Class::construct.
- *
- * \param object Object to be destroyed
- */
- void destroy(const UserObject& object) const;
-
- /**
- * \brief Start visitation of a class
- *
- * \param visitor Visitor to use for visitation
- */
- void visit(ClassVisitor& visitor) const;
-
- /**
- * \brief Convert a pointer to an object to be compatible with a base or derived metaclass
- *
- * The target metaclass may be a base or a derived of this, both cases are properly handled.
- *
- * \param pointer Pointer to convert
- * \param target Target metaclass to convert to
- *
- * \return Converted pointer
- *
- * \throw ClassUnrelated \a target is not a base nor a derived class of this
- */
- void* applyOffset(void* pointer, const Class& target) const;
-
- /**
- * \brief Operator == to check equality between two metaclasses
- *
- * Two metaclasses are equal if their name is the same.
- *
- * \param other Metaclass to compare with this
- *
- * \return True if both metaclasses are the same, false otherwise
- */
- bool operator==(const Class& other) const;
-
- /**
- * \brief Operator != to check inequality between two metaclasses
- *
- * \param other Metaclass to compare with this
- *
- * \return True if metaclasses are different, false if they are equal
- */
- bool operator!=(const Class& other) const;
-
-private:
-
- template <typename T> friend class ClassBuilder;
- friend class detail::ClassManager;
-
- /**
- * \brief Construct the metaclass from its name
- *
- * \param name Name of the metaclass
- */
- Class(const std::string& name);
-
- /**
- * \brief Get the offset of a base metaclass
- *
- * \param base Base metaclass to check
- *
- * \return offset between this and base, or -1 if both classes are unrelated
- */
- int baseOffset(const Class& base) const;
-
-private:
-
- /**
- * \brief Structure holding informations about a base metaclass
- */
- struct BaseInfo
- {
- const Class* base;
- int offset;
- };
-
- typedef boost::shared_ptr<Property> PropertyPtr;
- typedef boost::shared_ptr<Function> FunctionPtr;
- typedef boost::shared_ptr<Constructor> ConstructorPtr;
- typedef std::vector<ConstructorPtr> ConstructorList;
- typedef std::vector<BaseInfo> BaseList;
-
- struct Id;
- struct Name;
-
- typedef boost::multi_index_container<PropertyPtr,
- bm::indexed_by<bm::random_access<bm::tag<Id> >,
- bm::ordered_unique<bm::tag<Name>, bm::const_mem_fun<Property, const std::string&, &Property::name> >
- >
- > PropertyTable;
-
- typedef boost::multi_index_container<FunctionPtr,
- bm::indexed_by<bm::random_access<bm::tag<Id> >,
- bm::ordered_unique<bm::tag<Name>, bm::const_mem_fun<Function, const std::string&, &Function::name> >
- >
- > FunctionTable;
-
- typedef PropertyTable::index<Name>::type PropertyNameIndex;
- typedef FunctionTable::index<Name>::type FunctionNameIndex;
- typedef void (*Destructor)(const UserObject&);
-
- std::string m_name; ///< Name of the metaclass
- FunctionTable m_functions; ///< Table of metafunctions indexed by name
- PropertyTable m_properties; ///< Table of metaproperties indexed by name
- BaseList m_bases; ///< List of base metaclasses
- ConstructorList m_constructors; ///< List of metaconstructors
- Destructor m_destructor; ///< Destructor (function that is able to delete an abstract object)
-};
-
-} // namespace camp
-
-// Must be included here because of mutual dependance between Class and ClassBuilder
-#include <camp/classbuilder.hpp>
-
-#include <camp/class.inl>
-
-
-#endif // CAMP_CLASS_HPP
+/****************************************************************************
+**
+** Copyright (C) 2009-2010 TECHNOGERMA Systems France and/or its subsidiary(-ies).
+** Contact: Technogerma Systems France Information (contact at technogerma.fr)
+**
+** This file is part of the CAMP library.
+**
+** CAMP is free software: you can redistribute it and/or modify
+** it under the terms of the GNU Lesser General Public License as published by
+** the Free Software Foundation, either version 3 of the License, or
+** (at your option) any later version.
+**
+** CAMP is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU Lesser General Public License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public License
+** along with CAMP. If not, see <http://www.gnu.org/licenses/>.
+**
+****************************************************************************/
+
+
+#ifndef CAMP_CLASS_HPP
+#define CAMP_CLASS_HPP
+
+
+#include <camp/config.hpp>
+#include <camp/args.hpp>
+#include <camp/classget.hpp>
+#include <camp/classcast.hpp>
+#include <camp/property.hpp>
+#include <camp/function.hpp>
+#include <camp/tagholder.hpp>
+#include <camp/errors.hpp>
+#include <camp/userobject.hpp>
+#include <camp/detail/classmanager.hpp>
+#include <camp/detail/typeid.hpp>
+#include <boost/noncopyable.hpp>
+//#include <boost/shared_ptr.hpp>
+#include <boost/multi_index_container.hpp>
+#include <boost/multi_index/mem_fun.hpp>
+#include <boost/multi_index/ordered_index.hpp>
+#include <boost/multi_index/random_access_index.hpp>
+#include <string>
+
+
+namespace bm = boost::multi_index;
+
+namespace camp
+{
+template <typename T> class ClassBuilder;
+class Constructor;
+class Value;
+class ClassVisitor;
+
+/**
+ * \brief camp::Class represents a metaclass composed of properties and functions
+ *
+ * camp::Class is the main class of the CAMP API. It defines a metaclass, which
+ * is an abstract representation of a C++ class with its own properties,
+ * functions, constructors, base classes, etc.
+ *
+ * Classes are declared, bound to a C++ type and filled with the \c declare
+ * template function.
+ *
+ * \code
+ * class MyClass
+ * {
+ * public:
+ *
+ * MyClass();
+ * int getProp() const;
+ * void setProp(int);
+ * std::string func();
+ * };
+ *
+ * camp::Class::declare<MyClass>("MyClass")
+ * .tag("help", "this is my class")
+ * .constructor0()
+ * .property("prop", &MyClass::getProp, &MyClass::setProp)
+ * .function("func", &MyClass::func);
+ * \endcode
+ *
+ * It then provides a set of accessors to retrieve its member functions and properties.
+ *
+ * \code
+ * const camp::Class& metaclass = camp::classByType<MyClass>();
+ *
+ * const camp::Property& prop = metaclass.property("prop");
+ * const camp::Function& func = metaclass.function("func");
+ * \endcode
+ *
+ * Another way to inspect a class, which is more type-safe, is to use a ClassVisitor.
+ *
+ * \code
+ * MyVisitor visitor;
+ * metaclass.visit(visitor);
+ * \endcode
+ *
+ * It also allows to create and destroy instances of the bound C++ class.
+ *
+ * \code
+ * MyClass* obj = metaclass.construct<MyClass>();
+ * metaclass.destroy(obj);
+ * \endcode
+ *
+ * \remark All function and property names are unique within the metaclass.
+ *
+ * \sa Enum, TagHolder, ClassBuilder, Function, Property
+ */
+class CAMP_API Class : public TagHolder, boost::noncopyable
+{
+public:
+
+ /**
+ * \brief Declare a new metaclass
+ *
+ * This is the function to call to create a new metaclass. The template
+ * parameter T is the C++ class that will be bound to the metaclass.
+ *
+ * \param name Name of the metaclass in CAMP. This name identifies
+ * the metaclass and thus has to be unique
+ *
+ * \return A ClassBuilder<T> object that will provide functions
+ * to fill the new metaclass with properties, functions, etc.
+ */
+ template <typename T>
+ static ClassBuilder<T> declare(const std::string& name);
+
+public:
+
+ /**
+ * \brief Return the name of the metaclass
+ *
+ * \return String containing the name of the metaclass
+ */
+ const std::string& name() const;
+
+ /**
+ * \brief Return the total number of base metaclasses of this metaclass
+ *
+ * \return Number of base metaclasses
+ */
+ std::size_t baseCount() const;
+
+ /**
+ * \brief Return a base metaclass from its index
+ *
+ * \param index Index of the base to get
+ *
+ * \return Reference to the index-th base metaclass of this metaclass
+ *
+ * \throw OutOfRange index is out of range
+ */
+ const Class& base(std::size_t index) const;
+
+ /**
+ * \brief Return the total number of functions of this metaclass
+ *
+ * \return Number of functions
+ */
+ std::size_t functionCount() const;
+
+ /**
+ * \brief Check if this metaclass contains the given function
+ *
+ * \param name Name of the function to check
+ *
+ * \return True if the function is in the metaclass, false otherwise
+ */
+ bool hasFunction(const std::string& name) const;
+
+ /**
+ * \brief Get a function from its index in this metaclass
+ *
+ * \param index Index of the function to get
+ *
+ * \return Reference to the function
+ *
+ * \throw OutOfRange index is out of range
+ */
+ const Function& function(std::size_t index) const;
+
+ /**
+ * \brief Get a function from its name
+ *
+ * \param name Name of the function to get (case sensitive)
+ *
+ * \return Reference to the function
+ *
+ * \throw FunctionNotFound \a name is not a function of the metaclass
+ */
+ const Function& function(const std::string& name) const;
+
+ /**
+ * \brief Return the total number of properties of this metaclass
+ *
+ * \return Number of properties
+ */
+ std::size_t propertyCount() const;
+
+ /**
+ * \brief Check if this metaclass contains the given property
+ *
+ * \param name Name of the property to check
+ *
+ * \return True if the property is in the metaclass, false otherwise
+ */
+ bool hasProperty(const std::string& name) const;
+
+ /**
+ * \brief Get a property from its index in this metaclass
+ *
+ * \param index Index of the property to get
+ *
+ * \return Reference to the property
+ *
+ * \throw OutOfRange index is out of range
+ */
+ const Property& property(std::size_t index) const;
+
+ /**
+ * \brief Get a property from its name
+ *
+ * \param name Name of the property to get (case sensitive)
+ *
+ * \return Reference to the property
+ *
+ * \throw PropertyNotFound \a name is not a property of the metaclass
+ */
+ const Property& property(const std::string& name) const;
+
+ /**
+ * \brief Construct a new instance of the C++ class bound to the metaclass
+ *
+ * If no constructor can match the provided arguments, UserObject::nothing
+ * is returned.
+ * The new instance is wrapped into a UserObject. It must be destroyed
+ * with the Class::destroy function.
+ *
+ * \param args Arguments to pass to the constructor (empty by default)
+ *
+ * \return New instance wrapped into a UserObject, or UserObject::nothing if it failed
+ */
+ UserObject construct(const Args& args = Args::empty) const;
+
+ /**
+ * \brief Destroy an instance of the C++ class bound to the metaclass
+ *
+ * This function must be called to destroy every instance created with
+ * Class::construct.
+ *
+ * \param object Object to be destroyed
+ */
+ void destroy(const UserObject& object) const;
+
+ /**
+ * \brief Start visitation of a class
+ *
+ * \param visitor Visitor to use for visitation
+ */
+ void visit(ClassVisitor& visitor) const;
+
+ /**
+ * \brief Convert a pointer to an object to be compatible with a base or derived metaclass
+ *
+ * The target metaclass may be a base or a derived of this, both cases are properly handled.
+ *
+ * \param pointer Pointer to convert
+ * \param target Target metaclass to convert to
+ *
+ * \return Converted pointer
+ *
+ * \throw ClassUnrelated \a target is not a base nor a derived class of this
+ */
+ void* applyOffset(void* pointer, const Class& target) const;
+
+ /**
+ * \brief Operator == to check equality between two metaclasses
+ *
+ * Two metaclasses are equal if their name is the same.
+ *
+ * \param other Metaclass to compare with this
+ *
+ * \return True if both metaclasses are the same, false otherwise
+ */
+ bool operator==(const Class& other) const;
+
+ /**
+ * \brief Operator != to check inequality between two metaclasses
+ *
+ * \param other Metaclass to compare with this
+ *
+ * \return True if metaclasses are different, false if they are equal
+ */
+ bool operator!=(const Class& other) const;
+
+private:
+
+ template <typename T> friend class ClassBuilder;
+ friend class detail::ClassManager;
+
+ /**
+ * \brief Construct the metaclass from its name
+ *
+ * \param name Name of the metaclass
+ */
+ Class(const std::string& name);
+
+ /**
+ * \brief Get the offset of a base metaclass
+ *
+ * \param base Base metaclass to check
+ *
+ * \return offset between this and base, or -1 if both classes are unrelated
+ */
+ int baseOffset(const Class& base) const;
+
+private:
+
+ /**
+ * \brief Structure holding informations about a base metaclass
+ */
+ struct BaseInfo
+ {
+ const Class* base;
+ int offset;
+ };
+
+ typedef std::shared_ptr<Property> PropertyPtr;
+ typedef std::shared_ptr<Function> FunctionPtr;
+ typedef std::shared_ptr<Constructor> ConstructorPtr;
+ typedef std::vector<ConstructorPtr> ConstructorList;
+ typedef std::vector<BaseInfo> BaseList;
+
+ struct Id;
+ struct Name;
+
+ typedef boost::multi_index_container<PropertyPtr,
+ bm::indexed_by<bm::random_access<bm::tag<Id> >,
+ bm::ordered_unique<bm::tag<Name>, bm::const_mem_fun<Property, const std::string&, &Property::name> >
+ >
+ > PropertyTable;
+
+ typedef boost::multi_index_container<FunctionPtr,
+ bm::indexed_by<bm::random_access<bm::tag<Id> >,
+ bm::ordered_unique<bm::tag<Name>, bm::const_mem_fun<Function, const std::string&, &Function::name> >
+ >
+ > FunctionTable;
+
+ typedef PropertyTable::index<Name>::type PropertyNameIndex;
+ typedef FunctionTable::index<Name>::type FunctionNameIndex;
+ typedef void (*Destructor)(const UserObject&);
+
+ std::string m_name; ///< Name of the metaclass
+ FunctionTable m_functions; ///< Table of metafunctions indexed by name
+ PropertyTable m_properties; ///< Table of metaproperties indexed by name
+ BaseList m_bases; ///< List of base metaclasses
+ ConstructorList m_constructors; ///< List of metaconstructors
+ Destructor m_destructor; ///< Destructor (function that is able to delete an abstract object)
+};
+
+} // namespace camp
+
+// Must be included here because of mutual dependance between Class and ClassBuilder
+#include <camp/classbuilder.hpp>
+
+#include <camp/class.inl>
+
+
+#endif // CAMP_CLASS_HPP
diff --git a/include/camp/detail/classmanager.hpp b/include/camp/detail/classmanager.hpp
index a38b31f..5ac7b8b 100644
--- a/include/camp/detail/classmanager.hpp
+++ b/include/camp/detail/classmanager.hpp
@@ -1,189 +1,189 @@
-/****************************************************************************
-**
-** Copyright (C) 2009-2010 TECHNOGERMA Systems France and/or its subsidiary(-ies).
-** Contact: Technogerma Systems France Information (contact at technogerma.fr)
-**
-** This file is part of the CAMP library.
-**
-** CAMP is free software: you can redistribute it and/or modify
-** it under the terms of the GNU Lesser General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** CAMP is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU Lesser General Public License for more details.
-**
-** You should have received a copy of the GNU Lesser General Public License
-** along with CAMP. If not, see <http://www.gnu.org/licenses/>.
-**
-****************************************************************************/
-
-
-#ifndef CAMP_DETAIL_CLASSMANAGER_HPP
-#define CAMP_DETAIL_CLASSMANAGER_HPP
-
-
-#include <camp/config.hpp>
-#include <camp/detail/observernotifier.hpp>
-#include <boost/noncopyable.hpp>
-#include <boost/shared_ptr.hpp>
-#include <boost/shared_ptr.hpp>
-#include <boost/multi_index_container.hpp>
-#include <boost/multi_index/member.hpp>
-#include <boost/multi_index/ordered_index.hpp>
-#include <string>
-
-
-namespace bm = boost::multi_index;
-
-namespace camp
-{
-class Class;
-
-namespace detail
-{
-/**
- * \brief Manages creation, storage, retrieval and destruction of metaclasses
- *
- * camp::ClassManager is the place where all metaclasses are stored and accessed.
- * It consists of a singleton which is created on first use and destroyed at global exit.
- *
- * \sa Class
- */
-class CAMP_API ClassManager : public ObserverNotifier, boost::noncopyable
-{
-public:
-
- /**
- * \brief Get the unique instance of the class
- *
- * \return Reference to the unique instance of ClassManager
- */
- static ClassManager& instance();
-
- /**
- * \brief Create and register a new metaclass
- *
- * This is the entry point for every metaclass creation. This
- * function also notifies registered observers after successful creations.
- *
- * \param name Name of the metaclass to create (must be unique)
- * \param id Identifier of the C++ class bound to the metaclass
- *
- * \return Reference to the new metaclass
- *
- * \throw ClassAlreadyCreated \a name or \a id already exists
- */
- Class& addClass(const std::string& name, const std::string& id);
-
- /**
- * \brief Get the total number of metaclasses
- *
- * \return Number of metaclasses that have been registered
- */
- std::size_t count() const;
-
- /**
- * \brief Get a metaclass from its global index
- *
- * This function, together with ClassManager::count, provides a way to iterate through
- * all the metaclasses that have been declared.
- *
- * \param index Global index of the metaclass to get
- *
- * \return Reference to the index-th metaclass
- *
- * \throw OutOfRange index is out of range
- */
- const Class& getByIndex(std::size_t index) const;
-
- /**
- * \brief Get a metaclass from its name
- *
- * \param name Name of the metaclass to retrieve
- *
- * \return Reference to the requested metaclass
- *
- * \throw ClassNotFound name is not the name of an existing metaclass
- */
- const Class& getByName(const std::string& name) const;
-
- /**
- * \brief Get a metaclass from a C++ type
- *
- * \param id Identifier of the C++ type
- *
- * \return Reference to the requested metaclass
- *
- * \throw ClassNotFound id is not the name of an existing metaclass
- */
- const Class& getById(const std::string& id) const;
-
- /**
- * \brief Get a metaclass from a C++ type
- *
- * This version returns a null pointer if no metaclass is found, instead
- * of throwing an exception.
- *
- * \param id Identifier of the C++ type
- *
- * \return Pointer to the requested metaclass, or 0 if not found
- */
- const Class* getByIdSafe(const std::string& id) const;
-
- /**
- * \brief Check if a given type has a metaclass
- *
- * \param id Identifier of the C++ type
- *
- * \return True if the class exists, false otherwise
- */
- bool classExists(const std::string& id) const;
-
-private:
-
- /**
- * \brief Default constructor
- */
- ClassManager();
-
- /**
- * \brief Destructor
- *
- * The destructor destroys all the registered metaclasses and notifies the observers.
- */
- ~ClassManager();
-
- /**
- * \brief Structure gathering a class, its type identifier and its name
- */
- struct ClassInfo
- {
- std::string id;
- std::string name;
- boost::shared_ptr<Class> classPtr;
- };
-
- struct Id;
- struct Name;
-
- typedef boost::multi_index_container<ClassInfo,
- bm::indexed_by<bm::ordered_unique<bm::tag<Id>, bm::member<ClassInfo, std::string, &ClassInfo::id> >,
- bm::ordered_unique<bm::tag<Name>, bm::member<ClassInfo, std::string, &ClassInfo::name> >
- >
- > ClassTable;
-
- typedef ClassTable::index<Id>::type IdIndex;
- typedef ClassTable::index<Name>::type NameIndex;
-
- ClassTable m_classes; ///< Table storing classes indexed by their id and name
-};
-
-} // namespace detail
-
-} // namespace camp
-
-
-#endif // CAMP_DETAIL_CLASSMANAGER_HPP
+/****************************************************************************
+**
+** Copyright (C) 2009-2010 TECHNOGERMA Systems France and/or its subsidiary(-ies).
+** Contact: Technogerma Systems France Information (contact at technogerma.fr)
+**
+** This file is part of the CAMP library.
+**
+** CAMP is free software: you can redistribute it and/or modify
+** it under the terms of the GNU Lesser General Public License as published by
+** the Free Software Foundation, either version 3 of the License, or
+** (at your option) any later version.
+**
+** CAMP is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU Lesser General Public License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public License
+** along with CAMP. If not, see <http://www.gnu.org/licenses/>.
+**
+****************************************************************************/
+
+
+#ifndef CAMP_DETAIL_CLASSMANAGER_HPP
+#define CAMP_DETAIL_CLASSMANAGER_HPP
+
+
+#include <camp/config.hpp>
+#include <camp/detail/observernotifier.hpp>
+#include <boost/noncopyable.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/multi_index_container.hpp>
+#include <boost/multi_index/member.hpp>
+#include <boost/multi_index/ordered_index.hpp>
+#include <string>
+
+
+namespace bm = boost::multi_index;
+
+namespace camp
+{
+class Class;
+
+namespace detail
+{
+/**
+ * \brief Manages creation, storage, retrieval and destruction of metaclasses
+ *
+ * camp::ClassManager is the place where all metaclasses are stored and accessed.
+ * It consists of a singleton which is created on first use and destroyed at global exit.
+ *
+ * \sa Class
+ */
+class CAMP_API ClassManager : public ObserverNotifier, boost::noncopyable
+{
+public:
+
+ /**
+ * \brief Get the unique instance of the class
+ *
+ * \return Reference to the unique instance of ClassManager
+ */
+ static ClassManager& instance();
+
+ /**
+ * \brief Create and register a new metaclass
+ *
+ * This is the entry point for every metaclass creation. This
+ * function also notifies registered observers after successful creations.
+ *
+ * \param name Name of the metaclass to create (must be unique)
+ * \param id Identifier of the C++ class bound to the metaclass
+ *
+ * \return Reference to the new metaclass
+ *
+ * \throw ClassAlreadyCreated \a name or \a id already exists
+ */
+ Class& addClass(const std::string& name, const std::string& id);
+
+ /**
+ * \brief Get the total number of metaclasses
+ *
+ * \return Number of metaclasses that have been registered
+ */
+ std::size_t count() const;
+
+ /**
+ * \brief Get a metaclass from its global index
+ *
+ * This function, together with ClassManager::count, provides a way to iterate through
+ * all the metaclasses that have been declared.
+ *
+ * \param index Global index of the metaclass to get
+ *
+ * \return Reference to the index-th metaclass
+ *
+ * \throw OutOfRange index is out of range
+ */
+ const Class& getByIndex(std::size_t index) const;
+
+ /**
+ * \brief Get a metaclass from its name
+ *
+ * \param name Name of the metaclass to retrieve
+ *
+ * \return Reference to the requested metaclass
+ *
+ * \throw ClassNotFound name is not the name of an existing metaclass
+ */
+ const Class& getByName(const std::string& name) const;
+
+ /**
+ * \brief Get a metaclass from a C++ type
+ *
+ * \param id Identifier of the C++ type
+ *
+ * \return Reference to the requested metaclass
+ *
+ * \throw ClassNotFound id is not the name of an existing metaclass
+ */
+ const Class& getById(const std::string& id) const;
+
+ /**
+ * \brief Get a metaclass from a C++ type
+ *
+ * This version returns a null pointer if no metaclass is found, instead
+ * of throwing an exception.
+ *
+ * \param id Identifier of the C++ type
+ *
+ * \return Pointer to the requested metaclass, or 0 if not found
+ */
+ const Class* getByIdSafe(const std::string& id) const;
+
+ /**
+ * \brief Check if a given type has a metaclass
+ *
+ * \param id Identifier of the C++ type
+ *
+ * \return True if the class exists, false otherwise
+ */
+ bool classExists(const std::string& id) const;
+
+private:
+
+ /**
+ * \brief Default constructor
+ */
+ ClassManager();
+
+ /**
+ * \brief Destructor
+ *
+ * The destructor destroys all the registered metaclasses and notifies the observers.
+ */
+ ~ClassManager();
+
+ /**
+ * \brief Structure gathering a class, its type identifier and its name
+ */
+ struct ClassInfo
+ {
+ std::string id;
+ std::string name;
+ std::shared_ptr<Class> classPtr;
+ };
+
+ struct Id;
+ struct Name;
+
+ typedef boost::multi_index_container<ClassInfo,
+ bm::indexed_by<bm::ordered_unique<bm::tag<Id>, bm::member<ClassInfo, std::string, &ClassInfo::id> >,
+ bm::ordered_unique<bm::tag<Name>, bm::member<ClassInfo, std::string, &ClassInfo::name> >
+ >
+ > ClassTable;
+
+ typedef ClassTable::index<Id>::type IdIndex;
+ typedef ClassTable::index<Name>::type NameIndex;
+
+ ClassTable m_classes; ///< Table storing classes indexed by their id and name
+};
+
+} // namespace detail
+
+} // namespace camp
+
+
+#endif // CAMP_DETAIL_CLASSMANAGER_HPP
diff --git a/include/camp/detail/enummanager.hpp b/include/camp/detail/enummanager.hpp
index 721cf09..78d0732 100644
--- a/include/camp/detail/enummanager.hpp
+++ b/include/camp/detail/enummanager.hpp
@@ -1,186 +1,186 @@
-/****************************************************************************
-**
-** Copyright (C) 2009-2010 TECHNOGERMA Systems France and/or its subsidiary(-ies).
-** Contact: Technogerma Systems France Information (contact at technogerma.fr)
-**
-** This file is part of the CAMP library.
-**
-** CAMP is free software: you can redistribute it and/or modify
-** it under the terms of the GNU Lesser General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** CAMP is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU Lesser General Public License for more details.
-**
-** You should have received a copy of the GNU Lesser General Public License
-** along with CAMP. If not, see <http://www.gnu.org/licenses/>.
-**
-****************************************************************************/
-
-
-#ifndef CAMP_DETAIL_ENUMMANAGER_HPP
-#define CAMP_DETAIL_ENUMMANAGER_HPP
-
-
-#include <camp/config.hpp>
-#include <camp/detail/observernotifier.hpp>
-#include <boost/noncopyable.hpp>
-#include <boost/shared_ptr.hpp>
-#include <boost/multi_index_container.hpp>
-#include <boost/multi_index/member.hpp>
-#include <boost/multi_index/ordered_index.hpp>
-#include <string>
-
-
-namespace bm = boost::multi_index;
-
-namespace camp
-{
-class Enum;
-
-namespace detail
-{
-/**
- * \brief Manages creation, storage, retrieval and destruction of metaenums
- *
- * camp::EnumManager is the place where all metaenums are stored and accessed.
- * It consists of a singleton which is created on first use and destroyed at global exit.
- *
- * \sa Enum
- */
-class CAMP_API EnumManager : public ObserverNotifier, boost::noncopyable
-{
-public:
-
- /**
- * \brief Get the unique instance of the class
- *
- * \return Reference to the unique instance of EnumManager
- */
- static EnumManager& instance();
-
- /**
- * \brief Create and register a new metaenum
- *
- * This is the entry point for every metaenum creation. This
- * function also notifies registered observers after successful creations.
- *
- * \param name Name of the metaenum to create (must be unique)
- * \param id Identifier of the C++ enum bound to the metaenum
- *
- * \return Reference to the new metaenum
- */
- Enum& addClass(const std::string& name, const std::string& id);
-
- /**
- * \brief Get the total number of metaenums
- *
- * \return Number of metaenums that have been registered
- */
- std::size_t count() const;
-
- /**
- * \brief Get a metaenum from its global index
- *
- * This function, together with EnumManager::count, provides a way to iterate through
- * all the metaenums that have been declared.
- *
- * \param index Global index of the metaenum to get
- *
- * \return Reference to the index-th metaenum
- *
- * \throw OutOfRange index is out of range
- */
- const Enum& getByIndex(std::size_t index) const;
-
- /**
- * \brief Get a metaenum from its name
- *
- * \param name Name of the metaenum to retrieve
- *
- * \return Reference to the requested metaenum
- *
- * \throw EnumNotFound name is not the name of an existing metaenum
- */
- const Enum& getByName(const std::string& name) const;
-
- /**
- * \brief Get a metaenum from a C++ type
- *
- * \param id Identifier of the C++ type
- *
- * \return Reference to the requested metaenum
- *
- * \throw EnumNotFound id is not the name of an existing metaenum
- */
- const Enum& getById(const std::string& id) const;
-
- /**
- * \brief Get a metaenum from a C++ type
- *
- * This version returns a null pointer if no metaenum is found, instead
- * of throwing an exception.
- *
- * \param id Identifier of the C++ type
- *
- * \return Pointer to the requested metaenum, or 0 if not found
- */
- const Enum* getByIdSafe(const std::string& id) const;
-
- /**
- * \brief Check if a given type has a metaenum
- *
- * \param id Identifier of the C++ type
- *
- * \return True if the enum exists, false otherwise
- */
- bool enumExists(const std::string& id) const;
-
-private:
-
- /**
- * \brief Default constructor
- */
- EnumManager();
-
- /**
- * \brief Destructor
- *
- * The destructor destroys all the registered metaenums and notifies the observers.
- */
- ~EnumManager();
-
- /**
- * \brief Structure gathering an enum, its type identifier and its name
- */
- struct EnumInfo
- {
- std::string id;
- std::string name;
- boost::shared_ptr<Enum> enumPtr;
- };
-
- struct Id;
- struct Name;
-
- typedef boost::multi_index_container<EnumInfo,
- bm::indexed_by<bm::ordered_unique<bm::tag<Id>, bm::member<EnumInfo, std::string, &EnumInfo::id> >,
- bm::ordered_unique<bm::tag<Name>, bm::member<EnumInfo, std::string, &EnumInfo::name> >
- >
- > EnumTable;
-
- typedef EnumTable::index<Id>::type IdIndex;
- typedef EnumTable::index<Name>::type NameIndex;
-
- EnumTable m_enums; ///< Table storing enums indexed by their id and name
-};
-
-} // namespace detail
-
-} // namespace camp
-
-
-#endif // CAMP_DETAIL_ENUMMANAGER_HPP
+/****************************************************************************
+**
+** Copyright (C) 2009-2010 TECHNOGERMA Systems France and/or its subsidiary(-ies).
+** Contact: Technogerma Systems France Information (contact at technogerma.fr)
+**
+** This file is part of the CAMP library.
+**
+** CAMP is free software: you can redistribute it and/or modify
+** it under the terms of the GNU Lesser General Public License as published by
+** the Free Software Foundation, either version 3 of the License, or
+** (at your option) any later version.
+**
+** CAMP is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU Lesser General Public License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public License
+** along with CAMP. If not, see <http://www.gnu.org/licenses/>.
+**
+****************************************************************************/
+
+
+#ifndef CAMP_DETAIL_ENUMMANAGER_HPP
+#define CAMP_DETAIL_ENUMMANAGER_HPP
+
+
+#include <camp/config.hpp>
+#include <camp/detail/observernotifier.hpp>
+#include <boost/noncopyable.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/multi_index_container.hpp>
+#include <boost/multi_index/member.hpp>
+#include <boost/multi_index/ordered_index.hpp>
+#include <string>
+
+
+namespace bm = boost::multi_index;
+
+namespace camp
+{
+class Enum;
+
+namespace detail
+{
+/**
+ * \brief Manages creation, storage, retrieval and destruction of metaenums
+ *
+ * camp::EnumManager is the place where all metaenums are stored and accessed.
+ * It consists of a singleton which is created on first use and destroyed at global exit.
+ *
+ * \sa Enum
+ */
+class CAMP_API EnumManager : public ObserverNotifier, boost::noncopyable
+{
+public:
+
+ /**
+ * \brief Get the unique instance of the class
+ *
+ * \return Reference to the unique instance of EnumManager
+ */
+ static EnumManager& instance();
+
+ /**
+ * \brief Create and register a new metaenum
+ *
+ * This is the entry point for every metaenum creation. This
+ * function also notifies registered observers after successful creations.
+ *
+ * \param name Name of the metaenum to create (must be unique)
+ * \param id Identifier of the C++ enum bound to the metaenum
+ *
+ * \return Reference to the new metaenum
+ */
+ Enum& addClass(const std::string& name, const std::string& id);
+
+ /**
+ * \brief Get the total number of metaenums
+ *
+ * \return Number of metaenums that have been registered
+ */
+ std::size_t count() const;
+
+ /**
+ * \brief Get a metaenum from its global index
+ *
+ * This function, together with EnumManager::count, provides a way to iterate through
+ * all the metaenums that have been declared.
+ *
+ * \param index Global index of the metaenum to get
+ *
+ * \return Reference to the index-th metaenum
+ *
+ * \throw OutOfRange index is out of range
+ */
+ const Enum& getByIndex(std::size_t index) const;
+
+ /**
+ * \brief Get a metaenum from its name
+ *
+ * \param name Name of the metaenum to retrieve
+ *
+ * \return Reference to the requested metaenum
+ *
+ * \throw EnumNotFound name is not the name of an existing metaenum
+ */
+ const Enum& getByName(const std::string& name) const;
+
+ /**
+ * \brief Get a metaenum from a C++ type
+ *
+ * \param id Identifier of the C++ type
+ *
+ * \return Reference to the requested metaenum
+ *
+ * \throw EnumNotFound id is not the name of an existing metaenum
+ */
+ const Enum& getById(const std::string& id) const;
+
+ /**
+ * \brief Get a metaenum from a C++ type
+ *
+ * This version returns a null pointer if no metaenum is found, instead
+ * of throwing an exception.
+ *
+ * \param id Identifier of the C++ type
+ *
+ * \return Pointer to the requested metaenum, or 0 if not found
+ */
+ const Enum* getByIdSafe(const std::string& id) const;
+
+ /**
+ * \brief Check if a given type has a metaenum
+ *
+ * \param id Identifier of the C++ type
+ *
+ * \return True if the enum exists, false otherwise
+ */
+ bool enumExists(const std::string& id) const;
+
+private:
+
+ /**
+ * \brief Default constructor
+ */
+ EnumManager();
+
+ /**
+ * \brief Destructor
+ *
+ * The destructor destroys all the registered metaenums and notifies the observers.
+ */
+ ~EnumManager();
+
+ /**
+ * \brief Structure gathering an enum, its type identifier and its name
+ */
+ struct EnumInfo
+ {
+ std::string id;
+ std::string name;
+ std::shared_ptr<Enum> enumPtr;
+ };
+
+ struct Id;
+ struct Name;
+
+ typedef boost::multi_index_container<EnumInfo,
+ bm::indexed_by<bm::ordered_unique<bm::tag<Id>, bm::member<EnumInfo, std::string, &EnumInfo::id> >,
+ bm::ordered_unique<bm::tag<Name>, bm::member<EnumInfo, std::string, &EnumInfo::name> >
+ >
+ > EnumTable;
+
+ typedef EnumTable::index<Id>::type IdIndex;
+ typedef EnumTable::index<Name>::type NameIndex;
+
+ EnumTable m_enums; ///< Table storing enums indexed by their id and name
+};
+
+} // namespace detail
+
+} // namespace camp
+
+
+#endif // CAMP_DETAIL_ENUMMANAGER_HPP
diff --git a/include/camp/detail/getter.hpp b/include/camp/detail/getter.hpp
index 9dbcf06..0984733 100644
--- a/include/camp/detail/getter.hpp
+++ b/include/camp/detail/getter.hpp
@@ -137,7 +137,7 @@ public:
private:
- boost::shared_ptr<GetterInterface<T> > m_getter; ///< Implementation of the getter
+ std::shared_ptr<GetterInterface<T> > m_getter; ///< Implementation of the getter
T m_defaultValue; ///< Default value to return if no function or no object is specified
};
diff --git a/include/camp/detail/issmartpointer.hpp b/include/camp/detail/issmartpointer.hpp
index 8c77f02..8c73dd7 100644
--- a/include/camp/detail/issmartpointer.hpp
+++ b/include/camp/detail/issmartpointer.hpp
@@ -27,7 +27,7 @@
#include <camp/detail/yesnotype.hpp>
#include <boost/utility/enable_if.hpp>
-
+#include <type_traits>
namespace camp
{
@@ -41,18 +41,7 @@ namespace detail
template <typename T, typename U>
struct IsSmartPointer
{
- // Check non-const signature
- template <typename V, U* (V::*)()> struct TestForMember {};
- template <typename V> static TypeYes check(TestForMember<V, &V::operator-> >*);
- template <typename V> static TypeNo check(...);
-
- // Check const signature
- template <typename V, U* (V::*)() const> struct TestForConstMember {};
- template <typename V> static TypeYes checkConst(TestForConstMember<V, &V::operator-> >*);
- template <typename V> static TypeNo checkConst(...);
-
- enum {value = (sizeof(check<T>(0)) == sizeof(TypeYes))
- || (sizeof(checkConst<T>(0)) == sizeof(TypeYes))};
+ enum {value = (!std::is_pointer<T>::value && !std::is_same<T, U>::value) };
};
} // namespace detail
diff --git a/include/camp/detail/objectholder.hpp b/include/camp/detail/objectholder.hpp
index 1923346..822f93f 100644
--- a/include/camp/detail/objectholder.hpp
+++ b/include/camp/detail/objectholder.hpp
@@ -126,7 +126,7 @@ public:
*/
ObjectHolderByRef(T* object);
- ObjectHolderByRef(boost::shared_ptr<T>* object);
+ ObjectHolderByRef(std::shared_ptr<T>* object);
/**
* \brief Return a typeless pointer to the stored object
diff --git a/include/camp/detail/objectholder.inl b/include/camp/detail/objectholder.inl
index 08bc694..0449481 100644
--- a/include/camp/detail/objectholder.inl
+++ b/include/camp/detail/objectholder.inl
@@ -68,7 +68,7 @@ ObjectHolderByRef<T>::ObjectHolderByRef(T* object)
//-------------------------------------------------------------------------------------------------
template <typename T>
-ObjectHolderByRef<T>::ObjectHolderByRef(::boost::shared_ptr<T>* object)
+ObjectHolderByRef<T>::ObjectHolderByRef(::std::shared_ptr<T>* object)
: m_object(object->get())
, m_alignedPtr(classCast(object, classByType<T>(), classByObject(object->get())))
{
diff --git a/include/camp/enum.hpp b/include/camp/enum.hpp
index f5d1c22..c820ac9 100644
--- a/include/camp/enum.hpp
+++ b/include/camp/enum.hpp
@@ -1,230 +1,230 @@
-/****************************************************************************
-**
-** Copyright (C) 2009-2010 TECHNOGERMA Systems France and/or its subsidiary(-ies).
-** Contact: Technogerma Systems France Information (contact at technogerma.fr)
-**
-** This file is part of the CAMP library.
-**
-** CAMP is free software: you can redistribute it and/or modify
-** it under the terms of the GNU Lesser General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** CAMP is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU Lesser General Public License for more details.
-**
-** You should have received a copy of the GNU Lesser General Public License
-** along with CAMP. If not, see <http://www.gnu.org/licenses/>.
-**
-****************************************************************************/
-
-
-#ifndef CAMP_ENUM_HPP
-#define CAMP_ENUM_HPP
-
-
-#include <camp/config.hpp>
-#include <camp/enumbuilder.hpp>
-#include <camp/enumget.hpp>
-#include <camp/detail/enummanager.hpp>
-#include <camp/detail/typeid.hpp>
-#include <boost/noncopyable.hpp>
-#include <boost/multi_index_container.hpp>
-#include <boost/multi_index/member.hpp>
-#include <boost/multi_index/ordered_index.hpp>
-#include <boost/multi_index/random_access_index.hpp>
-#include <string>
-
-
-namespace bm = boost::multi_index;
-
-namespace camp
-{
-/**
- * \brief camp::Enum represents a metaenum composed of <name, value> pairs
- *
- * Enums are declared, bound to a C++ type and filled with the \c declare
- * template function.
- *
- * \code
- * enum MyEnum {one = 1, two = 2, ten = 10};
- *
- * camp::Enum::declare<MyEnum>("MyEnum")
- * .value("one", one)
- * .value("two", two)
- * .value("ten", ten);
- * \endcode
- *
- * It then provides a set of accessors to retrieve names, values and pairs contained in it.
- *
- * \code
- * const camp::Enum& metaenum = camp::enumByType<MyEnum>();
- *
- * bool b1 = metaenum.hasName("one"); // b1 == true
- * bool b2 = metaenum.hasValue(5); // b2 == false
- *
- * std::string s = metaenum.name(10); // s == "ten"
- * long l = metaenum.value("two"); // l == 2
- *
- * camp::Enum::Pair p = metaenum.pair(0); // p == {"one", one}
- * \endcode
- *
- * \remark All values and names are unique within the metaenum.
- *
- * \sa Class, EnumBuilder
- */
-class CAMP_API Enum : boost::noncopyable
-{
-public:
-
- /**
- * \brief Structure defining the <name, value> pairs stored in metaenums
- */
- struct Pair
- {
- std::string name; ///< Name of the pair
- long value; ///< Value of the pair
- };
-
-public:
-
- /**
- * \brief Declare a new metaenum
- *
- * This is the function to call to create a new metaenum. The template
- * parameter T is the C++ enum type that will be bound to the metaclass.
- *
- * \param name Name of the metaenum in CAMP. This name identifies
- * the metaenum and thus has to be unique
- *
- * \return A EnumBuilder object that will provide functions
- * to fill the new metaenum with values.
- */
- template <typename T>
- static EnumBuilder declare(const std::string& name);
-
-public:
-
- /**
- * \brief Return the name of the metaenum
- *
- * \return String containing the name of the metaenum
- */
- const std::string& name() const;
-
- /**
- * \brief Return the size of the metaenum
- *
- * \return Total number of values contained in the metaenum
- */
- std::size_t size() const;
-
- /**
- * \brief Get a pair by its index
- *
- * \param index Index of the pair to get
- *
- * \return index-th pair
- *
- * \throw OutOfRange index is out of range
- */
- const Pair& pair(std::size_t index) const;
-
- /**
- * \brief Check if the enum contains a name
- *
- * \param name Name to check
- *
- * \return True if the metaenum contains a pair whose name is \a name
- */
- bool hasName(const std::string& name) const;
-
- /**
- * \brief Check if the enum contains a value
- *
- * \param value Value to check
- *
- * \return True if the metaenum contains a pair whose value is \a value
- */
- bool hasValue(long value) const;
-
- /**
- * \brief Return the name corresponding to given a value
- *
- * \param value Value to get
- *
- * \return Name of the requested value
- *
- * \throw InvalidEnumValue value doesn't exist in the metaenum
- */
- const std::string& name(long value) const;
-
- /**
- * \brief Return the value corresponding to given a name
- *
- * \param name Name to get
- *
- * \return Value of the requested name
- *
- * \throw InvalidEnumName name doesn't exist in the metaenum
- */
- long value(const std::string& name) const;
-
- /**
- * \brief Operator == to check equality between two metaenums
- *
- * Two metaenums are equal if their name is the same.
- *
- * \param other Metaenum to compare with this
- *
- * \return True if both metaenums are the same, false otherwise
- */
- bool operator==(const Enum& other) const;
-
- /**
- * \brief Operator != to check inequality between two metaenums
- *
- * \param other Metaenum to compare with this
- *
- * \return True if metaenums are different, false if they are equal
- */
- bool operator!=(const Enum& other) const;
-
-private:
-
- friend class EnumBuilder;
- friend class detail::EnumManager;
-
- /**
- * \brief Construct the metaenum from its name
- *
- * \param name Name of the metaenum
- */
- Enum(const std::string& name);
-
- struct Id;
- struct Val;
- struct Name;
-
- typedef boost::multi_index_container<Pair,
- bm::indexed_by<bm::random_access<bm::tag<Id> >,
- bm::ordered_unique<bm::tag<Val>, bm::member<Pair, long, &Pair::value> >,
- bm::ordered_unique<bm::tag<Name>, bm::member<Pair, std::string, &Pair::name> >
- >
- > PairTable;
-
- typedef PairTable::index<Val>::type ValueIndex;
- typedef PairTable::index<Name>::type NameIndex;
-
- std::string m_name; ///< Name of the metaenum
- PairTable m_pairs; ///< Table of pairs, indexed by their value and name
-};
-
-} // namespace camp
-
-#include <camp/enum.inl>
-
-
-#endif // CAMP_ENUM_HPP
+/****************************************************************************
+**
+** Copyright (C) 2009-2010 TECHNOGERMA Systems France and/or its subsidiary(-ies).
+** Contact: Technogerma Systems France Information (contact at technogerma.fr)
+**
+** This file is part of the CAMP library.
+**
+** CAMP is free software: you can redistribute it and/or modify
+** it under the terms of the GNU Lesser General Public License as published by
+** the Free Software Foundation, either version 3 of the License, or
+** (at your option) any later version.
+**
+** CAMP is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU Lesser General Public License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public License
+** along with CAMP. If not, see <http://www.gnu.org/licenses/>.
+**
+****************************************************************************/
+
+
+#ifndef CAMP_ENUM_HPP
+#define CAMP_ENUM_HPP
+
+
+#include <camp/config.hpp>
+#include <camp/enumbuilder.hpp>
+#include <camp/enumget.hpp>
+#include <camp/detail/enummanager.hpp>
+#include <camp/detail/typeid.hpp>
+#include <boost/noncopyable.hpp>
+#include <boost/multi_index_container.hpp>
+#include <boost/multi_index/member.hpp>
+#include <boost/multi_index/ordered_index.hpp>
+#include <boost/multi_index/random_access_index.hpp>
+#include <string>
+
+
+namespace bm = boost::multi_index;
+
+namespace camp
+{
+/**
+ * \brief camp::Enum represents a metaenum composed of <name, value> pairs
+ *
+ * Enums are declared, bound to a C++ type and filled with the \c declare
+ * template function.
+ *
+ * \code
+ * enum MyEnum {one = 1, two = 2, ten = 10};
+ *
+ * camp::Enum::declare<MyEnum>("MyEnum")
+ * .value("one", one)
+ * .value("two", two)
+ * .value("ten", ten);
+ * \endcode
+ *
+ * It then provides a set of accessors to retrieve names, values and pairs contained in it.
+ *
+ * \code
+ * const camp::Enum& metaenum = camp::enumByType<MyEnum>();
+ *
+ * bool b1 = metaenum.hasName("one"); // b1 == true
+ * bool b2 = metaenum.hasValue(5); // b2 == false
+ *
+ * std::string s = metaenum.name(10); // s == "ten"
+ * long l = metaenum.value("two"); // l == 2
+ *
+ * camp::Enum::Pair p = metaenum.pair(0); // p == {"one", one}
+ * \endcode
+ *
+ * \remark All values and names are unique within the metaenum.
+ *
+ * \sa Class, EnumBuilder
+ */
+class CAMP_API Enum : boost::noncopyable
+{
+public:
+
+ /**
+ * \brief Structure defining the <name, value> pairs stored in metaenums
+ */
+ struct Pair
+ {
+ std::string name; ///< Name of the pair
+ long value; ///< Value of the pair
+ };
+
+public:
+
+ /**
+ * \brief Declare a new metaenum
+ *
+ * This is the function to call to create a new metaenum. The template
+ * parameter T is the C++ enum type that will be bound to the metaclass.
+ *
+ * \param name Name of the metaenum in CAMP. This name identifies
+ * the metaenum and thus has to be unique
+ *
+ * \return A EnumBuilder object that will provide functions
+ * to fill the new metaenum with values.
+ */
+ template <typename T>
+ static EnumBuilder declare(const std::string& name);
+
+public:
+
+ /**
+ * \brief Return the name of the metaenum
+ *
+ * \return String containing the name of the metaenum
+ */
+ const std::string& name() const;
+
+ /**
+ * \brief Return the size of the metaenum
+ *
+ * \return Total number of values contained in the metaenum
+ */
+ std::size_t size() const;
+
+ /**
+ * \brief Get a pair by its index
+ *
+ * \param index Index of the pair to get
+ *
+ * \return index-th pair
+ *
+ * \throw OutOfRange index is out of range
+ */
+ const Pair& pair(std::size_t index) const;
+
+ /**
+ * \brief Check if the enum contains a name
+ *
+ * \param name Name to check
+ *
+ * \return True if the metaenum contains a pair whose name is \a name
+ */
+ bool hasName(const std::string& name) const;
+
+ /**
+ * \brief Check if the enum contains a value
+ *
+ * \param value Value to check
+ *
+ * \return True if the metaenum contains a pair whose value is \a value
+ */
+ bool hasValue(long value) const;
+
+ /**
+ * \brief Return the name corresponding to given a value
+ *
+ * \param value Value to get
+ *
+ * \return Name of the requested value
+ *
+ * \throw InvalidEnumValue value doesn't exist in the metaenum
+ */
+ const std::string& name(long value) const;
+
+ /**
+ * \brief Return the value corresponding to given a name
+ *
+ * \param name Name to get
+ *
+ * \return Value of the requested name
+ *
+ * \throw InvalidEnumName name doesn't exist in the metaenum
+ */
+ long value(const std::string& name) const;
+
+ /**
+ * \brief Operator == to check equality between two metaenums
+ *
+ * Two metaenums are equal if their name is the same.
+ *
+ * \param other Metaenum to compare with this
+ *
+ * \return True if both metaenums are the same, false otherwise
+ */
+ bool operator==(const Enum& other) const;
+
+ /**
+ * \brief Operator != to check inequality between two metaenums
+ *
+ * \param other Metaenum to compare with this
+ *
+ * \return True if metaenums are different, false if they are equal
+ */
+ bool operator!=(const Enum& other) const;
+
+private:
+
+ friend class EnumBuilder;
+ friend class detail::EnumManager;
+
+ /**
+ * \brief Construct the metaenum from its name
+ *
+ * \param name Name of the metaenum
+ */
+ Enum(const std::string& name);
+
+ struct Id;
+ struct Val;
+ struct Name;
+
+ typedef boost::multi_index_container<Pair,
+ bm::indexed_by<bm::random_access<bm::tag<Id> >,
+ bm::ordered_unique<bm::tag<Val>, bm::member<Pair, long, &Pair::value> >,
+ bm::ordered_unique<bm::tag<Name>, bm::member<Pair, std::string, &Pair::name> >
+ >
+ > PairTable;
+
+ typedef PairTable::index<Val>::type ValueIndex;
+ typedef PairTable::index<Name>::type NameIndex;
+
+ std::string m_name; ///< Name of the metaenum
+ PairTable m_pairs; ///< Table of pairs, indexed by their value and name
+};
+
+} // namespace camp
+
+#include <camp/enum.inl>
+
+
+#endif // CAMP_ENUM_HPP
diff --git a/include/camp/userobject.hpp b/include/camp/userobject.hpp
index e618046..5b070d5 100644
--- a/include/camp/userobject.hpp
+++ b/include/camp/userobject.hpp
@@ -279,7 +279,7 @@ private:
private:
const Class* m_class; ///< Metaclass of the stored object
- boost::shared_ptr<detail::AbstractObjectHolder> m_holder; ///< Optional abstract holder storing the object
+ std::shared_ptr<detail::AbstractObjectHolder> m_holder; ///< Optional abstract holder storing the object
boost::scoped_ptr<ParentObject> m_parent; ///< Optional parent object
const UserObject* m_child; ///< Optional pointer to the child object (m_parent.object.m_child == this)
};
diff --git a/src/classmanager.cpp b/src/classmanager.cpp
index b5a4144..37372dd 100644
--- a/src/classmanager.cpp
+++ b/src/classmanager.cpp
@@ -49,7 +49,7 @@ Class& ClassManager::addClass(const std::string& name, const std::string& id)
CAMP_ERROR(ClassAlreadyCreated(name, id));
// Create the new class
- boost::shared_ptr<Class> newClass(new Class(name));
+ std::shared_ptr<Class> newClass(new Class(name));
// Insert it into the table
ClassInfo info;
diff --git a/src/enummanager.cpp b/src/enummanager.cpp
index dddf431..cdcfd82 100644
--- a/src/enummanager.cpp
+++ b/src/enummanager.cpp
@@ -49,7 +49,7 @@ Enum& EnumManager::addClass(const std::string& name, const std::string& id)
CAMP_ERROR(EnumAlreadyCreated(name, id));
// Create the new class
- boost::shared_ptr<Enum> newEnum(new Enum(name));
+ std::shared_ptr<Enum> newEnum(new Enum(name));
// Insert it into the table
EnumInfo info;
diff --git a/test/function.hpp b/test/function.hpp
index 037b66d..160d4d1 100644
--- a/test/function.hpp
+++ b/test/function.hpp
@@ -1,177 +1,177 @@
-/****************************************************************************
-**
-** Copyright (C) 2009-2010 TECHNOGERMA Systems France and/or its subsidiary(-ies).
-** Contact: Technogerma Systems France Information (contact at technogerma.fr)
-**
-** This file is part of the CAMP library.
-**
-** CAMP is free software: you can redistribute it and/or modify
-** it under the terms of the GNU Lesser General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** CAMP is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU Lesser General Public License for more details.
-**
-** You should have received a copy of the GNU Lesser General Public License
-** along with CAMP. If not, see <http://www.gnu.org/licenses/>.
-**
-****************************************************************************/
-
-#ifndef CAMPTEST_FUNCTION_HPP
-#define CAMPTEST_FUNCTION_HPP
-
-#include <camp/camptype.hpp>
-#include <camp/enum.hpp>
-#include <camp/class.hpp>
-#include <camp/value.hpp>
-#include <boost/shared_ptr.hpp>
-#include <string>
-
-namespace FunctionTest
-{
- enum MyEnum
- {
- Zero = 0,
- One = 1,
- Two = 2
- };
-
- struct MyType
- {
- MyType(int x_) : x(x_) {}
- int x;
- };
-
- bool operator==(const MyType& left, const MyType& right) {return left.x == right.x;}
- bool operator<(const MyType& left, const MyType& right) {return left.x < right.x;}
- std::ostream& operator<<(std::ostream& stream, const MyType& object) {return stream << object.x;}
-
- struct MyBase
- {
- void f6() {}
- char padding[10];
- };
-
- struct MyClass : MyBase
- {
- MyClass()
- : p1(true)
- , p2(2)
- , p3("3")
- , p4(MyType(4))
- , p5(MyType(5))
- , innerPtr(&inner)
- , innerSmartPtr(new Inner)
- {
- }
-
- bool p1;
- int p2;
- std::string p3;
-
- MyType p4; const MyType& f4() {return p4;}
- MyType p5; const MyType& f5() const {return p5;}
- // f6 is inherited
- camp::Value f7(camp::Value v) {return v;}
-
- void f8() {}
- void f9(bool) {}
- void f10(float, double) {}
- void f11(short, int, long) {}
- void f12(const std::string&, std::string, const std::string&, std::string) {}
- void f13(MyEnum, MyEnum, MyEnum, MyEnum, MyEnum) {}
-
- struct Inner
- {
- void f14() {}
- void f15() const {}
- int f16() {return 16;}
- void f17(int) {}
- void f18() {}
- void f19() {}
- };
- Inner inner;
- const Inner& getInner() const {return inner;}
- Inner* innerPtr;
- const Inner* getInnerPtr() const {return innerPtr;}
- boost::shared_ptr<Inner> innerSmartPtr;
- const boost::shared_ptr<Inner> getInnerSmartPtr() {return innerSmartPtr;}
-
- int f20(int x) {return x;}
- int f21(int x, int y) {return x + y;}
- int f22(int x, int y, int z) {return x + y + z;}
- };
-
- void f1(MyClass& object)
- {
- object.p1 = true;
- }
-
- int f2(MyClass object, int x)
- {
- return object.p2 + x;
- }
-
- const std::string& f3(const MyClass* object)
- {
- return object->p3;
- }
-
- void declare()
- {
- camp::Enum::declare<MyEnum>("FunctionTest::MyEnum")
- .value("Zero", Zero)
- .value("One", One)
- .value("Two", Two);
-
- camp::Class::declare<MyType>("FunctionTest::MyType");
-
- camp::Class::declare<MyBase>("FunctionTest::MyBase");
-
- camp::Class::declare<MyClass>("FunctionTest::MyClass")
- .base<MyBase>()
-
- // ***** non-member functions *****
- .function("f1", &f1) // object by reference
- .function("f2", &f2) // object by value + parameter
- .function("f3", &f3) // object by pointer
-
- // ***** member functions *****
- .function("f4", &MyClass::f4) // non-const
- .function("f5", &MyClass::f5) // const
- .function("f6", &MyClass::f6) // inherited
- .function("f7", &MyClass::f7) // camp::Value as return and argument types
-
- // ***** arguments count ******
- .function("f8", &MyClass::f8) // 0 argument
- .function("f9", &MyClass::f9) // 1 argument
- .function("f10", &MyClass::f10) // 2 arguments
- .function("f11", &MyClass::f11) // 3 arguments
- .function("f12", &MyClass::f12) // 4 arguments
- .function("f13", &MyClass::f13) // 5 arguments
-
- // ***** nested functions *****
- // TOFIX .function("f14", &MyClass::Inner::f14, &MyClass::inner) // object
- .function("f15", &MyClass::Inner::f15, &MyClass::getInner) // getter returning an object
- .function("f16", &MyClass::Inner::f16, &MyClass::innerPtr) // raw pointer
- // TOFIX .function("f17", &MyClass::Inner::f17, &MyClass::getInnerPtr) // getter returning a raw pointer
- .function("f18", &MyClass::Inner::f18, &MyClass::innerSmartPtr) // smart pointer
- .function("f19", &MyClass::Inner::f19, &MyClass::getInnerSmartPtr) // getter returning a smart pointer
-
- // ***** boost::function *****
- .function("f20", boost::function<int (MyClass&, int)>(boost::bind(&MyClass::f20, _1, _2)))
- .function("f21", boost::function<int (MyClass&, int)>(boost::bind(&MyClass::f21, _1, _2, 20)))
- .function("f22", boost::function<int (MyClass&, int)>(boost::bind(boost::bind(&MyClass::f22, _1, _2, _3, 30), _1, _2, 20)))
- ;
- }
-}
-
-CAMP_AUTO_TYPE(FunctionTest::MyEnum, &FunctionTest::declare)
-CAMP_AUTO_TYPE(FunctionTest::MyType, &FunctionTest::declare)
-CAMP_AUTO_TYPE(FunctionTest::MyClass, &FunctionTest::declare)
-CAMP_AUTO_TYPE(FunctionTest::MyBase, &FunctionTest::declare)
-
-#endif // CAMPTEST_FUNCTION_HPP
+/****************************************************************************
+**
+** Copyright (C) 2009-2010 TECHNOGERMA Systems France and/or its subsidiary(-ies).
+** Contact: Technogerma Systems France Information (contact at technogerma.fr)
+**
+** This file is part of the CAMP library.
+**
+** CAMP is free software: you can redistribute it and/or modify
+** it under the terms of the GNU Lesser General Public License as published by
+** the Free Software Foundation, either version 3 of the License, or
+** (at your option) any later version.
+**
+** CAMP is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU Lesser General Public License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public License
+** along with CAMP. If not, see <http://www.gnu.org/licenses/>.
+**
+****************************************************************************/
+
+#ifndef CAMPTEST_FUNCTION_HPP
+#define CAMPTEST_FUNCTION_HPP
+
+#include <camp/camptype.hpp>
+#include <camp/enum.hpp>
+#include <camp/class.hpp>
+#include <camp/value.hpp>
+#include <boost/shared_ptr.hpp>
+#include <string>
+
+namespace FunctionTest
+{
+ enum MyEnum
+ {
+ Zero = 0,
+ One = 1,
+ Two = 2
+ };
+
+ struct MyType
+ {
+ MyType(int x_) : x(x_) {}
+ int x;
+ };
+
+ bool operator==(const MyType& left, const MyType& right) {return left.x == right.x;}
+ bool operator<(const MyType& left, const MyType& right) {return left.x < right.x;}
+ std::ostream& operator<<(std::ostream& stream, const MyType& object) {return stream << object.x;}
+
+ struct MyBase
+ {
+ void f6() {}
+ char padding[10];
+ };
+
+ struct MyClass : MyBase
+ {
+ MyClass()
+ : p1(true)
+ , p2(2)
+ , p3("3")
+ , p4(MyType(4))
+ , p5(MyType(5))
+ , innerPtr(&inner)
+ , innerSmartPtr(new Inner)
+ {
+ }
+
+ bool p1;
+ int p2;
+ std::string p3;
+
+ MyType p4; const MyType& f4() {return p4;}
+ MyType p5; const MyType& f5() const {return p5;}
+ // f6 is inherited
+ camp::Value f7(camp::Value v) {return v;}
+
+ void f8() {}
+ void f9(bool) {}
+ void f10(float, double) {}
+ void f11(short, int, long) {}
+ void f12(const std::string&, std::string, const std::string&, std::string) {}
+ void f13(MyEnum, MyEnum, MyEnum, MyEnum, MyEnum) {}
+
+ struct Inner
+ {
+ void f14() {}
+ void f15() const {}
+ int f16() {return 16;}
+ void f17(int) {}
+ void f18() {}
+ void f19() {}
+ };
+ Inner inner;
+ const Inner& getInner() const {return inner;}
+ Inner* innerPtr;
+ const Inner* getInnerPtr() const {return innerPtr;}
+ boost::shared_ptr<Inner> innerSmartPtr;
+ const boost::shared_ptr<Inner> getInnerSmartPtr() {return innerSmartPtr;}
+
+ int f20(int x) {return x;}
+ int f21(int x, int y) {return x + y;}
+ int f22(int x, int y, int z) {return x + y + z;}
+ };
+
+ void f1(MyClass& object)
+ {
+ object.p1 = true;
+ }
+
+ int f2(MyClass object, int x)
+ {
+ return object.p2 + x;
+ }
+
+ const std::string& f3(const MyClass* object)
+ {
+ return object->p3;
+ }
+
+ void declare()
+ {
+ camp::Enum::declare<MyEnum>("FunctionTest::MyEnum")
+ .value("Zero", Zero)
+ .value("One", One)
+ .value("Two", Two);
+
+ camp::Class::declare<MyType>("FunctionTest::MyType");
+
+ camp::Class::declare<MyBase>("FunctionTest::MyBase");
+
+ camp::Class::declare<MyClass>("FunctionTest::MyClass")
+ .base<MyBase>()
+
+ // ***** non-member functions *****
+ .function("f1", &f1) // object by reference
+ .function("f2", &f2) // object by value + parameter
+ .function("f3", &f3) // object by pointer
+
+ // ***** member functions *****
+ .function("f4", &MyClass::f4) // non-const
+ .function("f5", &MyClass::f5) // const
+ .function("f6", &MyClass::f6) // inherited
+ .function("f7", &MyClass::f7) // camp::Value as return and argument types
+
+ // ***** arguments count ******
+ .function("f8", &MyClass::f8) // 0 argument
+ .function("f9", &MyClass::f9) // 1 argument
+ .function("f10", &MyClass::f10) // 2 arguments
+ .function("f11", &MyClass::f11) // 3 arguments
+ .function("f12", &MyClass::f12) // 4 arguments
+ .function("f13", &MyClass::f13) // 5 arguments
+
+ // ***** nested functions *****
+ // TOFIX .function("f14", &MyClass::Inner::f14, &MyClass::inner) // object
+ .function("f15", &MyClass::Inner::f15, &MyClass::getInner) // getter returning an object
+ .function("f16", &MyClass::Inner::f16, &MyClass::innerPtr) // raw pointer
+ // TOFIX .function("f17", &MyClass::Inner::f17, &MyClass::getInnerPtr) // getter returning a raw pointer
+ .function("f18", &MyClass::Inner::f18, &MyClass::innerSmartPtr) // smart pointer
+ .function("f19", &MyClass::Inner::f19, &MyClass::getInnerSmartPtr) // getter returning a smart pointer
+
+ // ***** boost::function *****
+ .function("f20", boost::function<int (MyClass&, int)>(boost::bind(&MyClass::f20, _1, _2)))
+ .function("f21", boost::function<int (MyClass&, int)>(boost::bind(&MyClass::f21, _1, _2, 20)))
+ .function("f22", boost::function<int (MyClass&, int)>(boost::bind(boost::bind(&MyClass::f22, _1, _2, _3, 30), _1, _2, 20)))
+ ;
+ }
+}
+
+CAMP_AUTO_TYPE(FunctionTest::MyEnum, &FunctionTest::declare)
+CAMP_AUTO_TYPE(FunctionTest::MyType, &FunctionTest::declare)
+CAMP_AUTO_TYPE(FunctionTest::MyClass, &FunctionTest::declare)
+CAMP_AUTO_TYPE(FunctionTest::MyBase, &FunctionTest::declare)
+
+#endif // CAMPTEST_FUNCTION_HPP
diff --git a/test/functionaccess.hpp b/test/functionaccess.hpp
index 3b573e7..4dc1022 100644
--- a/test/functionaccess.hpp
+++ b/test/functionaccess.hpp
@@ -1,65 +1,65 @@
-/****************************************************************************
-**
-** Copyright (C) 2009-2010 TECHNOGERMA Systems France and/or its subsidiary(-ies).
-** Contact: Technogerma Systems France Information (contact at technogerma.fr)
-**
-** This file is part of the CAMP library.
-**
-** CAMP is free software: you can redistribute it and/or modify
-** it under the terms of the GNU Lesser General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** CAMP is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU Lesser General Public License for more details.
-**
-** You should have received a copy of the GNU Lesser General Public License
-** along with CAMP. If not, see <http://www.gnu.org/licenses/>.
-**
-****************************************************************************/
-
-#ifndef CAMPTEST_FUNCTIONACCESS_HPP
-#define CAMPTEST_FUNCTIONACCESS_HPP
-
-#include <camp/camptype.hpp>
-#include <camp/class.hpp>
-
-namespace FunctionAccessTest
-{
- struct MyClass
- {
- MyClass(bool b = true)
- : m_b(b)
- {
- }
-
- void f() {}
-
- bool m_b;
- bool b1() {return true;}
- bool b2() const {return false;}
- };
-
- void declare()
- {
- camp::Class::declare<MyClass>("FunctionAccessTest::MyClass")
-
- // ***** constant value *****
- .function("f0", &MyClass::f).callable(false)
- .function("f1", &MyClass::f).callable(true)
-
- // ***** function *****
- .function("f2", &MyClass::f).callable(&MyClass::b1)
- .function("f3", &MyClass::f).callable(&MyClass::b2)
- .function("f4", &MyClass::f).callable(boost::bind(&MyClass::b1, _1))
- .function("f5", &MyClass::f).callable(&MyClass::m_b)
- .function("f6", &MyClass::f).callable(boost::function<bool (MyClass&)>(&MyClass::m_b))
- ;
- }
-}
-
-CAMP_AUTO_TYPE(FunctionAccessTest::MyClass, &FunctionAccessTest::declare);
-
-#endif // CAMPTEST_FUNCTIONACCESS_HPP
+/****************************************************************************
+**
+** Copyright (C) 2009-2010 TECHNOGERMA Systems France and/or its subsidiary(-ies).
+** Contact: Technogerma Systems France Information (contact at technogerma.fr)
+**
+** This file is part of the CAMP library.
+**
+** CAMP is free software: you can redistribute it and/or modify
+** it under the terms of the GNU Lesser General Public License as published by
+** the Free Software Foundation, either version 3 of the License, or
+** (at your option) any later version.
+**
+** CAMP is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU Lesser General Public License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public License
+** along with CAMP. If not, see <http://www.gnu.org/licenses/>.
+**
+****************************************************************************/
+
+#ifndef CAMPTEST_FUNCTIONACCESS_HPP
+#define CAMPTEST_FUNCTIONACCESS_HPP
+
+#include <camp/camptype.hpp>
+#include <camp/class.hpp>
+
+namespace FunctionAccessTest
+{
+ struct MyClass
+ {
+ MyClass(bool b = true)
+ : m_b(b)
+ {
+ }
+
+ void f() {}
+
+ bool m_b;
+ bool b1() {return true;}
+ bool b2() const {return false;}
+ };
+
+ void declare()
+ {
+ camp::Class::declare<MyClass>("FunctionAccessTest::MyClass")
+
+ // ***** constant value *****
+ .function("f0", &MyClass::f).callable(false)
+ .function("f1", &MyClass::f).callable(true)
+
+ // ***** function *****
+ .function("f2", &MyClass::f).callable(&MyClass::b1)
+ .function("f3", &MyClass::f).callable(&MyClass::b2)
+ .function("f4", &MyClass::f).callable(boost::bind(&MyClass::b1, _1))
+ .function("f5", &MyClass::f).callable(&MyClass::m_b)
+ .function("f6", &MyClass::f).callable(boost::function<bool (MyClass&)>(&MyClass::m_b))
+ ;
+ }
+}
+
+CAMP_AUTO_TYPE(FunctionAccessTest::MyClass, &FunctionAccessTest::declare);
+
+#endif // CAMPTEST_FUNCTIONACCESS_HPP
diff --git a/test/inheritance.hpp b/test/inheritance.hpp
index b8b6048..fb1e4f6 100644
--- a/test/inheritance.hpp
+++ b/test/inheritance.hpp
@@ -1,115 +1,115 @@
-/****************************************************************************
-**
-** Copyright (C) 2009-2010 TECHNOGERMA Systems France and/or its subsidiary(-ies).
-** Contact: Technogerma Systems France Information (contact at technogerma.fr)
-**
-** This file is part of the CAMP library.
-**
-** CAMP is free software: you can redistribute it and/or modify
-** it under the terms of the GNU Lesser General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** CAMP is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU Lesser General Public License for more details.
-**
-** You should have received a copy of the GNU Lesser General Public License
-** along with CAMP. If not, see <http://www.gnu.org/licenses/>.
-**
-****************************************************************************/
-
-#ifndef CAMPTEST_INHERITANCE_HPP
-#define CAMPTEST_INHERITANCE_HPP
-
-#include <camp/camptype.hpp>
-#include <camp/class.hpp>
-
-namespace InheritanceTest
-{
- struct MyClass1
- {
- MyClass1() : p1(10), po1(10) {}
- virtual ~MyClass1() {}
- int p1;
- int f1() const {return 1;}
- int po1;
- int fo1() {return 1;}
- CAMP_RTTI();
- };
-
- struct MyClass2
- {
- MyClass2() : p2(20), po2(20) {}
- virtual ~MyClass2() {}
- int p2;
- int f2() const {return 2;}
- virtual int fv() const {return p2;}
- int po2;
- int fo2() {return 2;}
- CAMP_RTTI();
- };
-
- struct MyClass3 : public MyClass1, public MyClass2
- {
- MyClass3() : p3(30), po3(30) {}
- virtual ~MyClass3() {}
- int p3;
- int f3() const {return 3;}
- virtual int fv() const {return p3;}
- int po3;
- int fo3() {return 3;}
- CAMP_RTTI();
- };
-
- struct MyClass4 : public MyClass3
- {
- MyClass4() : p4(40), po4(40) {}
- virtual ~MyClass4() {}
- int p4;
- int f4() const {return 4;}
- virtual int fv() const {return p4;}
- int po4;
- int fo4() {return 4;}
- CAMP_RTTI();
- };
-
- void declare()
- {
- camp::Class::declare<MyClass1>("InheritanceTest::MyClass1")
- .function("f1", &MyClass1::f1)
- .property("p1", &MyClass1::p1)
- .function("overridden", &MyClass1::fo1)
- .property("overridden", &MyClass1::po1);
-
- camp::Class::declare<MyClass2>("InheritanceTest::MyClass2")
- .function("f2", &MyClass2::f2)
- .property("p2", &MyClass2::p2)
- .function("virtual", &MyClass2::fv)
- .function("overridden", &MyClass2::fo2)
- .property("overridden", &MyClass2::po2);
-
- camp::Class::declare<MyClass3>("InheritanceTest::MyClass3")
- .base<MyClass1>()
- .base<MyClass2>()
- .function("f3", &MyClass3::f3)
- .property("p3", &MyClass3::p3)
- .function("overridden", &MyClass3::fo3)
- .property("overridden", &MyClass3::po3);
-
- camp::Class::declare<MyClass4>("InheritanceTest::MyClass4")
- .base<MyClass3>()
- .function("f4", &MyClass4::f4)
- .property("p4", &MyClass4::p4)
- .function("overridden", &MyClass4::fo4)
- .property("overridden", &MyClass4::po4);
- }
-}
-
-CAMP_AUTO_TYPE(InheritanceTest::MyClass1, &InheritanceTest::declare)
-CAMP_AUTO_TYPE(InheritanceTest::MyClass2, &InheritanceTest::declare)
-CAMP_AUTO_TYPE(InheritanceTest::MyClass3, &InheritanceTest::declare)
-CAMP_AUTO_TYPE(InheritanceTest::MyClass4, &InheritanceTest::declare)
-
-#endif // CAMPTEST_INHERITANCE_HPP
+/****************************************************************************
+**
+** Copyright (C) 2009-2010 TECHNOGERMA Systems France and/or its subsidiary(-ies).
+** Contact: Technogerma Systems France Information (contact at technogerma.fr)
+**
+** This file is part of the CAMP library.
+**
+** CAMP is free software: you can redistribute it and/or modify
+** it under the terms of the GNU Lesser General Public License as published by
+** the Free Software Foundation, either version 3 of the License, or
+** (at your option) any later version.
+**
+** CAMP is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU Lesser General Public License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public License
+** along with CAMP. If not, see <http://www.gnu.org/licenses/>.
+**
+****************************************************************************/
+
+#ifndef CAMPTEST_INHERITANCE_HPP
+#define CAMPTEST_INHERITANCE_HPP
+
+#include <camp/camptype.hpp>
+#include <camp/class.hpp>
+
+namespace InheritanceTest
+{
+ struct MyClass1
+ {
+ MyClass1() : p1(10), po1(10) {}
+ virtual ~MyClass1() {}
+ int p1;
+ int f1() const {return 1;}
+ int po1;
+ int fo1() {return 1;}
+ CAMP_RTTI();
+ };
+
+ struct MyClass2
+ {
+ MyClass2() : p2(20), po2(20) {}
+ virtual ~MyClass2() {}
+ int p2;
+ int f2() const {return 2;}
+ virtual int fv() const {return p2;}
+ int po2;
+ int fo2() {return 2;}
+ CAMP_RTTI();
+ };
+
+ struct MyClass3 : public MyClass1, public MyClass2
+ {
+ MyClass3() : p3(30), po3(30) {}
+ virtual ~MyClass3() {}
+ int p3;
+ int f3() const {return 3;}
+ virtual int fv() const {return p3;}
+ int po3;
+ int fo3() {return 3;}
+ CAMP_RTTI();
+ };
+
+ struct MyClass4 : public MyClass3
+ {
+ MyClass4() : p4(40), po4(40) {}
+ virtual ~MyClass4() {}
+ int p4;
+ int f4() const {return 4;}
+ virtual int fv() const {return p4;}
+ int po4;
+ int fo4() {return 4;}
+ CAMP_RTTI();
+ };
+
+ void declare()
+ {
+ camp::Class::declare<MyClass1>("InheritanceTest::MyClass1")
+ .function("f1", &MyClass1::f1)
+ .property("p1", &MyClass1::p1)
+ .function("overridden", &MyClass1::fo1)
+ .property("overridden", &MyClass1::po1);
+
+ camp::Class::declare<MyClass2>("InheritanceTest::MyClass2")
+ .function("f2", &MyClass2::f2)
+ .property("p2", &MyClass2::p2)
+ .function("virtual", &MyClass2::fv)
+ .function("overridden", &MyClass2::fo2)
+ .property("overridden", &MyClass2::po2);
+
+ camp::Class::declare<MyClass3>("InheritanceTest::MyClass3")
+ .base<MyClass1>()
+ .base<MyClass2>()
+ .function("f3", &MyClass3::f3)
+ .property("p3", &MyClass3::p3)
+ .function("overridden", &MyClass3::fo3)
+ .property("overridden", &MyClass3::po3);
+
+ camp::Class::declare<MyClass4>("InheritanceTest::MyClass4")
+ .base<MyClass3>()
+ .function("f4", &MyClass4::f4)
+ .property("p4", &MyClass4::p4)
+ .function("overridden", &MyClass4::fo4)
+ .property("overridden", &MyClass4::po4);
+ }
+}
+
+CAMP_AUTO_TYPE(InheritanceTest::MyClass1, &InheritanceTest::declare)
+CAMP_AUTO_TYPE(InheritanceTest::MyClass2, &InheritanceTest::declare)
+CAMP_AUTO_TYPE(InheritanceTest::MyClass3, &InheritanceTest::declare)
+CAMP_AUTO_TYPE(InheritanceTest::MyClass4, &InheritanceTest::declare)
+
+#endif // CAMPTEST_INHERITANCE_HPP
diff --git a/test/mapper.hpp b/test/mapper.hpp
index 2b0347f..cb7fb7f 100644
--- a/test/mapper.hpp
+++ b/test/mapper.hpp
@@ -1,148 +1,148 @@
-/****************************************************************************
-**
-** Copyright (C) 2009-2010 TECHNOGERMA Systems France and/or its subsidiary(-ies).
-** Contact: Technogerma Systems France Information (contact at technogerma.fr)
-**
-** This file is part of the CAMP library.
-**
-** CAMP is free software: you can redistribute it and/or modify
-** it under the terms of the GNU Lesser General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** CAMP is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU Lesser General Public License for more details.
-**
-** You should have received a copy of the GNU Lesser General Public License
-** along with CAMP. If not, see <http://www.gnu.org/licenses/>.
-**
-****************************************************************************/
-
-#ifndef CAMPTEST_MAPPER_HPP
-#define CAMPTEST_MAPPER_HPP
-
-#include <camp/camptype.hpp>
-#include <camp/class.hpp>
-#include <camp/simpleproperty.hpp>
-#include <camp/function.hpp>
-#include <map>
-#include <string>
-
-namespace MapperTest
-{
- struct MyClass
- {
- enum
- {
- propertyCount = 5,
- functionCount = 3
- };
-
- static std::string property(std::size_t index)
- {
- const char* names[] = {"prop0", "prop1", "prop2", "prop3", "prop4"};
- return names[index];
- }
-
- static std::string function(std::size_t index)
- {
- const char* names[] = {"func0", "func1", "func2"};
- return names[index];
- }
-
- MyClass()
- {
- m_props[property(0)] = 0;
- m_props[property(1)] = 10;
- m_props[property(2)] = 20;
- m_props[property(3)] = 30;
- m_props[property(4)] = 40;
- }
-
- int& prop(const std::string& name)
- {
- return m_props[name];
- }
-
- std::string func(const std::string& name)
- {
- return name + "_called";
- }
-
- std::map<std::string, int> m_props;
- };
-
- template <typename T>
- struct MyMapper
- {
- std::size_t propertyCount()
- {
- return T::propertyCount;
- }
-
- camp::Property* property(std::size_t index)
- {
- return new MyProperty(T::property(index));
- }
-
- std::size_t functionCount()
- {
- return T::functionCount;
- }
-
- camp::Function* function(std::size_t index)
- {
- return new MyFunction(T::function(index));
- }
-
- struct MyProperty : public camp::SimpleProperty
- {
- public:
-
- MyProperty(const std::string& name)
- : camp::SimpleProperty(name, camp::intType)
- {
- }
-
- virtual camp::Value getValue(const camp::UserObject& object) const
- {
- T& t = object.get<T>();
- return t.prop(name());
- }
-
- virtual void setValue(const camp::UserObject& object, const camp::Value& value) const
- {
- T& t = object.get<T>();
- t.prop(name()) = value.to<int>();
- }
- };
-
- class MyFunction : public camp::Function
- {
- public:
-
- MyFunction(const std::string& name)
- : camp::Function(name, camp::stringType)
- {
- }
-
- virtual camp::Value execute(const camp::UserObject& object, const camp::Args&) const
- {
- T& t = object.get<T>();
- return t.func(name());
- }
- };
- };
-
- void declare()
- {
- camp::Class::declare<MyClass>("MapperTest::MyClass")
- .external<MyMapper>();
- }
-}
-
-CAMP_AUTO_TYPE(MapperTest::MyClass, &MapperTest::declare)
-
-#endif // CAMPTEST_MAPPER_HPP
+/****************************************************************************
+**
+** Copyright (C) 2009-2010 TECHNOGERMA Systems France and/or its subsidiary(-ies).
+** Contact: Technogerma Systems France Information (contact at technogerma.fr)
+**
+** This file is part of the CAMP library.
+**
+** CAMP is free software: you can redistribute it and/or modify
+** it under the terms of the GNU Lesser General Public License as published by
+** the Free Software Foundation, either version 3 of the License, or
+** (at your option) any later version.
+**
+** CAMP is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU Lesser General Public License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public License
+** along with CAMP. If not, see <http://www.gnu.org/licenses/>.
+**
+****************************************************************************/
+
+#ifndef CAMPTEST_MAPPER_HPP
+#define CAMPTEST_MAPPER_HPP
+
+#include <camp/camptype.hpp>
+#include <camp/class.hpp>
+#include <camp/simpleproperty.hpp>
+#include <camp/function.hpp>
+#include <map>
+#include <string>
+
+namespace MapperTest
+{
+ struct MyClass
+ {
+ enum
+ {
+ propertyCount = 5,
+ functionCount = 3
+ };
+
+ static std::string property(std::size_t index)
+ {
+ const char* names[] = {"prop0", "prop1", "prop2", "prop3", "prop4"};
+ return names[index];
+ }
+
+ static std::string function(std::size_t index)
+ {
+ const char* names[] = {"func0", "func1", "func2"};
+ return names[index];
+ }
+
+ MyClass()
+ {
+ m_props[property(0)] = 0;
+ m_props[property(1)] = 10;
+ m_props[property(2)] = 20;
+ m_props[property(3)] = 30;
+ m_props[property(4)] = 40;
+ }
+
+ int& prop(const std::string& name)
+ {
+ return m_props[name];
+ }
+
+ std::string func(const std::string& name)
+ {
+ return name + "_called";
+ }
+
+ std::map<std::string, int> m_props;
+ };
+
+ template <typename T>
+ struct MyMapper
+ {
+ std::size_t propertyCount()
+ {
+ return T::propertyCount;
+ }
+
+ camp::Property* property(std::size_t index)
+ {
+ return new MyProperty(T::property(index));
+ }
+
+ std::size_t functionCount()
+ {
+ return T::functionCount;
+ }
+
+ camp::Function* function(std::size_t index)
+ {
+ return new MyFunction(T::function(index));
+ }
+
+ struct MyProperty : public camp::SimpleProperty
+ {
+ public:
+
+ MyProperty(const std::string& name)
+ : camp::SimpleProperty(name, camp::intType)
+ {
+ }
+
+ virtual camp::Value getValue(const camp::UserObject& object) const
+ {
+ T& t = object.get<T>();
+ return t.prop(name());
+ }
+
+ virtual void setValue(const camp::UserObject& object, const camp::Value& value) const
+ {
+ T& t = object.get<T>();
+ t.prop(name()) = value.to<int>();
+ }
+ };
+
+ class MyFunction : public camp::Function
+ {
+ public:
+
+ MyFunction(const std::string& name)
+ : camp::Function(name, camp::stringType)
+ {
+ }
+
+ virtual camp::Value execute(const camp::UserObject& object, const camp::Args&) const
+ {
+ T& t = object.get<T>();
+ return t.func(name());
+ }
+ };
+ };
+
+ void declare()
+ {
+ camp::Class::declare<MyClass>("MapperTest::MyClass")
+ .external<MyMapper>();
+ }
+}
+
+CAMP_AUTO_TYPE(MapperTest::MyClass, &MapperTest::declare)
+
+#endif // CAMPTEST_MAPPER_HPP
diff --git a/test/propertyaccess.hpp b/test/propertyaccess.hpp
index 3097232..20628c6 100644
--- a/test/propertyaccess.hpp
+++ b/test/propertyaccess.hpp
@@ -1,74 +1,74 @@
-/****************************************************************************
-**
-** Copyright (C) 2009-2010 TECHNOGERMA Systems France and/or its subsidiary(-ies).
-** Contact: Technogerma Systems France Information (contact at technogerma.fr)
-**
-** This file is part of the CAMP library.
-**
-** CAMP is free software: you can redistribute it and/or modify
-** it under the terms of the GNU Lesser General Public License as published by
-** the Free Software Foundation, either version 3 of the License, or
-** (at your option) any later version.
-**
-** CAMP is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU Lesser General Public License for more details.
-**
-** You should have received a copy of the GNU Lesser General Public License
-** along with CAMP. If not, see <http://www.gnu.org/licenses/>.
-**
-****************************************************************************/
-
-#ifndef CAMPTEST_PROPERTYACCESS_HPP
-#define CAMPTEST_PROPERTYACCESS_HPP
-
-#include <camp/camptype.hpp>
-#include <camp/class.hpp>
-
-namespace PropertyAccessTest
-{
- struct MyClass
- {
- MyClass(bool b = true)
- : m_b(b)
- {
- }
-
- void set(int x) {p = x;}
- int get() const {return p;}
- int& ref() {return p;}
- int p;
-
- bool m_b;
- bool b1() {return true;}
- bool b2() const {return false;}
- };
-
- void declare()
- {
- camp::Class::declare<MyClass>("PropertyAccessTest::MyClass")
-
- // ***** constant value *****
- .property("p0", &MyClass::p).readable(false).writable(true)
- .property("p1", &MyClass::p).readable(true).writable(false)
- .property("p2", &MyClass::p).readable(false).writable(false)
-
- // ***** function *****
- .property("p3", &MyClass::p).readable(&MyClass::b1)
- .property("p4", &MyClass::p).readable(&MyClass::b2)
- .property("p5", &MyClass::p).readable(boost::bind(&MyClass::b1, _1))
- .property("p6", &MyClass::p).readable(&MyClass::m_b)
- .property("p7", &MyClass::p).readable(boost::function<bool (MyClass&)>(&MyClass::m_b))
-
- // ***** implicit - based on the availability of a getter/setter *****
- .property("p8", &MyClass::get)
- .property("p9", &MyClass::ref)
- .property("p10", &MyClass::get, &MyClass::set)
- ;
- }
-}
-
-CAMP_AUTO_TYPE(PropertyAccessTest::MyClass, &PropertyAccessTest::declare)
-
-#endif // CAMPTEST_PROPERTYACCESS_HPP
+/****************************************************************************
+**
+** Copyright (C) 2009-2010 TECHNOGERMA Systems France and/or its subsidiary(-ies).
+** Contact: Technogerma Systems France Information (contact at technogerma.fr)
+**
+** This file is part of the CAMP library.
+**
+** CAMP is free software: you can redistribute it and/or modify
+** it under the terms of the GNU Lesser General Public License as published by
+** the Free Software Foundation, either version 3 of the License, or
+** (at your option) any later version.
+**
+** CAMP is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU Lesser General Public License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public License
+** along with CAMP. If not, see <http://www.gnu.org/licenses/>.
+**
+****************************************************************************/
+
+#ifndef CAMPTEST_PROPERTYACCESS_HPP
+#define CAMPTEST_PROPERTYACCESS_HPP
+
+#include <camp/camptype.hpp>
+#include <camp/class.hpp>
+
+namespace PropertyAccessTest
+{
+ struct MyClass
+ {
+ MyClass(bool b = true)
+ : m_b(b)
+ {
+ }
+
+ void set(int x) {p = x;}
+ int get() const {return p;}
+ int& ref() {return p;}
+ int p;
+
+ bool m_b;
+ bool b1() {return true;}
+ bool b2() const {return false;}
+ };
+
+ void declare()
+ {
+ camp::Class::declare<MyClass>("PropertyAccessTest::MyClass")
+
+ // ***** constant value *****
+ .property("p0", &MyClass::p).readable(false).writable(true)
+ .property("p1", &MyClass::p).readable(true).writable(false)
+ .property("p2", &MyClass::p).readable(false).writable(false)
+
+ // ***** function *****
+ .property("p3", &MyClass::p).readable(&MyClass::b1)
+ .property("p4", &MyClass::p).readable(&MyClass::b2)
+ .property("p5", &MyClass::p).readable(boost::bind(&MyClass::b1, _1))
+ .property("p6", &MyClass::p).readable(&MyClass::m_b)
+ .property("p7", &MyClass::p).readable(boost::function<bool (MyClass&)>(&MyClass::m_b))
+
+ // ***** implicit - based on the availability of a getter/setter *****
+ .property("p8", &MyClass::get)
+ .property("p9", &MyClass::ref)
+ .property("p10", &MyClass::get, &MyClass::set)
+ ;
+ }
+}
+
+CAMP_AUTO_TYPE(PropertyAccessTest::MyClass, &PropertyAccessTest::declare)
+
+#endif // CAMPTEST_PROPERTYACCESS_HPP
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/camp.git
More information about the debian-med-commit
mailing list