Boost logo

Boost-Commit :

From: jmcintyre_at_[hidden]
Date: 2007-08-23 23:28:11


Author: jared
Date: 2007-08-23 23:28:10 EDT (Thu, 23 Aug 2007)
New Revision: 38885
URL: http://svn.boost.org/trac/boost/changeset/38885

Log:
No longer need to define the type of the property in add_property
Removed:
   sandbox/pinhole/libs/pinhole/test/TestSerializer.cpp
Text files modified:
   sandbox/pinhole/boost/pinhole/map_key_value_iterators.h | 6 -
   sandbox/pinhole/boost/pinhole/property_group.h | 145 ++++++++++++++++++++++++++++++---------
   sandbox/pinhole/boost/pinhole/property_group_wrapper.h | 16 ++--
   sandbox/pinhole/libs/pinhole/test/TestClassesAndConstants.h | 116 +++++++++++++++----------------
   sandbox/pinhole/libs/pinhole/test/TestPropertyGroupWrapper.cpp | 20 ++--
   sandbox/pinhole/libs/pinhole/test/TestPropertyGroups.cpp | 4
   6 files changed, 187 insertions(+), 120 deletions(-)

Modified: sandbox/pinhole/boost/pinhole/map_key_value_iterators.h
==============================================================================
--- sandbox/pinhole/boost/pinhole/map_key_value_iterators.h (original)
+++ sandbox/pinhole/boost/pinhole/map_key_value_iterators.h 2007-08-23 23:28:10 EDT (Thu, 23 Aug 2007)
@@ -67,8 +67,7 @@
     
     /** Factory for creating map_key_iterator iterators. */
     template <class Iterator>
- map_key_iterator<Iterator>
- make_map_key_iterator(Iterator x, Iterator end = Iterator())
+ map_key_iterator<Iterator> make_map_key_iterator(Iterator x, Iterator end = Iterator())
     {
             return map_key_iterator<Iterator>(x,end);
     }
@@ -116,8 +115,7 @@
     
     /** Factory for creating map_value_iterator iterators. */
     template <class Iterator>
- map_value_iterator<Iterator>
- make_map_value_iterator(Iterator x, Iterator end = Iterator())
+ map_value_iterator<Iterator> make_map_value_iterator(Iterator x, Iterator end = Iterator())
     {
             return map_value_iterator<Iterator>(x,end);
     }

Modified: sandbox/pinhole/boost/pinhole/property_group.h
==============================================================================
--- sandbox/pinhole/boost/pinhole/property_group.h (original)
+++ sandbox/pinhole/boost/pinhole/property_group.h 2007-08-23 23:28:10 EDT (Thu, 23 Aug 2007)
@@ -86,8 +86,11 @@
 
     #define BOOST_GETTER_VAR(c) property_system_var_getter_builder(c)
 
- #define BOOST_SETTER_NONE NULL
- #define BOOST_GETTER_NONE NULL
+ struct no_setter_struct {};
+ struct no_getter_struct {};
+
+ #define BOOST_SETTER_NONE no_setter_struct()
+ #define BOOST_GETTER_NONE no_getter_struct()
 
     class property_group;
 
@@ -559,61 +562,91 @@
         //@}
 
     protected:
-
+
         /**
          * Adds a property to the property list.
- * @param The name of the property.
+ * @param name The name of the property.
          * @param description A brief description of the property for the user interface.
          * @param setter The function used to set the property.
          * @param getter The function used to get the property.
          */
- template<typename Value_Type>
+ template<typename Setter, typename Getter>
         void add_property( std::string name,
                            std::string description,
- boost::function<void (const Value_Type&)> setter,
- boost::function<Value_Type ()> getter )
+ Setter setter,
+ Getter getter)
         {
- typedef typename detail::EditorTypeFinder<Value_Type>::type editor_type;
-
- // You are using a Value_Type that does not have a default editor defined. Use once
- // of the add_property functions where you explicitly define the editor or editor type.
- BOOST_STATIC_ASSERT((false == boost::is_same<editor_type, boost::mpl::void_>::value));
-
- add_property<Value_Type>( name, description, setter, getter, new editor_type() );
+ internal_add_property< typename Getter::result_type >( name, description, setter, getter);
         }
-
+
         /**
          * Adds a property to the property list.
- * @param The name of the property.
+ * @param name The name of the property.
          * @param description A brief description of the property for the user interface.
          * @param setter The function used to set the property.
          * @param getter The function used to get the property.
- * @param pEditor A pointer to the editor to be used with this property, or null
- * if there isn't one.
          */
- template<typename Value_Type>
+ template<typename Getter>
+ void add_property( std::string name,
+ std::string description,
+ no_setter_struct setter,
+ Getter getter)
+ {
+ internal_add_property< typename Getter::result_type >( name, description, NULL, getter);
+ }
+
+ /**
+ * Adds a property to the property list.
+ * @param name The name of the property.
+ * @param description A brief description of the property for the user interface.
+ * @param setter The function used to set the property.
+ * @param getter The function used to get the property.
+ */
+ template<typename Setter, typename Getter>
         void add_property( std::string name,
                            std::string description,
- boost::function<void (const Value_Type&)> setter,
- boost::function<Value_Type ()> getter,
+ Setter setter,
+ no_getter_struct getter)
+ {
+ internal_add_property< typename Setter::argument_type >( name, description, setter, NULL);
+ }
+
+ /**
+ * Adds a property to the property list.
+ * @param name The name of the property.
+ * @param description A brief description of the property for the user interface.
+ * @param setter The function used to set the property.
+ * @param getter The function used to get the property.
+ * @param pEditor A pointer to the editor to be used with this property, or null
+ * if there isn't one.
+ */
+ template< typename Setter, typename Getter>
+ void add_property( string name,
+ string description,
+ Setter setter,
+ Getter getter,
                            Editor *pEditor )
         {
- // If you get an error here, then the type you are using for the property likely doesn't have a proper operator<< for it
- detail::property_info<Value_Type> *prop = new detail::property_info<Value_Type>();
-
- prop->m_name = name;
- prop->m_description = description;
- if( BOOST_SETTER_NONE != setter )
- {
- prop->setter = setter;
- }
- if( BOOST_GETTER_NONE != getter )
- {
- prop->getter = getter;
- }
- prop->m_editor = pEditor;
+ internal_add_property< typename Getter::result_type >( name, description, setter, getter, pEditor);
+ }
 
- m_properties.insert( std::make_pair(name, prop) );
+ /**
+ * Adds a property to the property list.
+ * @param name The name of the property.
+ * @param description A brief description of the property for the user interface.
+ * @param setter The function used to set the property.
+ * @param getter The function used to get the property.
+ * @param pEditor A pointer to the editor to be used with this property, or null
+ * if there isn't one.
+ */
+ template< typename Getter>
+ void add_property( string name,
+ string description,
+ no_setter_struct,
+ Getter getter,
+ Editor *pEditor )
+ {
+ internal_add_property< typename Getter::result_type >( name, description, NULL, getter, pEditor);
         }
 
         /**
@@ -664,6 +697,46 @@
 
     private:
         property_group();
+
+ template<typename Value_Type>
+ void internal_add_property( const std::string &name,
+ const std::string &description,
+ boost::function<void (const Value_Type&)> setter,
+ boost::function<Value_Type ()> getter )
+ {
+ typedef typename detail::EditorTypeFinder<Value_Type>::type editor_type;
+
+ // You are using a Value_Type that does not have a default editor defined. Use once
+ // of the add_property functions where you explicitly define the editor or editor type.
+ BOOST_STATIC_ASSERT((false == boost::is_same<editor_type, boost::mpl::void_>::value));
+
+ internal_add_property<Value_Type>( name, description, setter, getter, new editor_type() );
+ }
+
+ template<typename Value_Type>
+ void internal_add_property( const std::string &name,
+ const std::string &description,
+ boost::function<void (const Value_Type&)> setter,
+ boost::function<Value_Type ()> getter,
+ Editor *pEditor )
+ {
+ // If you get an error here, then the type you are using for the property likely doesn't have a proper operator<< for it
+ detail::property_info<Value_Type> *prop = new detail::property_info<Value_Type>();
+
+ prop->m_name = name;
+ prop->m_description = description;
+ if( NULL != setter )
+ {
+ prop->setter = setter;
+ }
+ if( NULL != getter )
+ {
+ prop->getter = getter;
+ }
+ prop->m_editor = pEditor;
+
+ m_properties.insert( std::make_pair(name, prop) );
+ }
 
         void add_child(property_group* pChild)
         {

Modified: sandbox/pinhole/boost/pinhole/property_group_wrapper.h
==============================================================================
--- sandbox/pinhole/boost/pinhole/property_group_wrapper.h (original)
+++ sandbox/pinhole/boost/pinhole/property_group_wrapper.h 2007-08-23 23:28:10 EDT (Thu, 23 Aug 2007)
@@ -37,13 +37,13 @@
          * @param setter The function used to set the property.
          * @param getter The function used to get the property.
          */
- template<typename Value_Type>
+ template<typename Setter, typename Getter>
         void add_property( std::string name,
                            std::string description,
- boost::function<void (const Value_Type&)> setter,
- boost::function<Value_Type ()> getter )
+ Setter setter,
+ Getter getter )
         {
- property_group::add_property<Value_Type>( name, description,setter, getter );
+ property_group::add_property( name, description, setter, getter );
         }
 
         /**
@@ -55,15 +55,15 @@
          * @param pEditor A pointer to the editor to be used with this property, or null
          * if there isn't one.
          */
- template<typename Value_Type>
+ template<typename Setter, typename Getter>
         void add_property( std::string name,
                            std::string description,
- boost::function<void (const Value_Type&)> setter,
- boost::function<Value_Type ()> getter,
+ Setter setter,
+ Getter getter,
                            Editor *pEditor )
         {
             
- property_group::add_property<Value_Type>( name, description,setter, getter, pEditor );
+ property_group::add_property( name, description, setter, getter, pEditor );
         }
 
         /**

Modified: sandbox/pinhole/libs/pinhole/test/TestClassesAndConstants.h
==============================================================================
--- sandbox/pinhole/libs/pinhole/test/TestClassesAndConstants.h (original)
+++ sandbox/pinhole/libs/pinhole/test/TestClassesAndConstants.h 2007-08-23 23:28:10 EDT (Thu, 23 Aug 2007)
@@ -99,9 +99,9 @@
 public:
         TestPropertyChildGroup( property_group *pParentGroup) : property_group( PROPERTY_GROUP_CHILD_NAME, pParentGroup )
         {
- add_property<float>(PROPERTY_FLOAT_1, "PropertyFloat1 description", BOOST_SETTER(&TestPropertyChildGroup::SetFloat), BOOST_GETTER(&TestPropertyChildGroup::GetFloat), new FloatEditor());
- add_property<int>(PROPERTY_INT_1, "PropertyInt1 description", BOOST_SETTER(&TestPropertyChildGroup::SetInt), BOOST_GETTER(&TestPropertyChildGroup::GetInt), new IntegerEditor());
- add_property<string>(PROPERTY_STRING_2, "PropertyString2 description", BOOST_SETTER(&TestPropertyChildGroup::SetPropertyString2), BOOST_GETTER(&TestPropertyChildGroup::GetPropertyString2), new StringEditor());
+ add_property(PROPERTY_FLOAT_1, "PropertyFloat1 description", BOOST_SETTER(&TestPropertyChildGroup::SetFloat), BOOST_GETTER(&TestPropertyChildGroup::GetFloat), new FloatEditor());
+ add_property(PROPERTY_INT_1, "PropertyInt1 description", BOOST_SETTER(&TestPropertyChildGroup::SetInt), BOOST_GETTER(&TestPropertyChildGroup::GetInt), new IntegerEditor());
+ add_property(PROPERTY_STRING_2, "PropertyString2 description", BOOST_SETTER(&TestPropertyChildGroup::SetPropertyString2), BOOST_GETTER(&TestPropertyChildGroup::GetPropertyString2), new StringEditor());
         }
 
         float GetFloat() const{return( m_fFloat1 );}
@@ -127,16 +127,16 @@
         {
         m_bVarBool = false;
 
- add_property<string>(PROPERTY_STRING_1, "PropertyString1 description", BOOST_SETTER_NONE, BOOST_GETTER(&TestPropertyGroup::GetPropertyString1), new StringEditor());
- add_property<float>(PROPERTY_FLOAT_1, "PropertyFloat1 description", BOOST_SETTER(&TestPropertyGroup::SetFloat), BOOST_GETTER(&TestPropertyGroup::GetFloat), new FloatEditor());
- add_property<int>(PROPERTY_INT_1, "PropertyInt1 description", BOOST_SETTER(&TestPropertyGroup::SetInt), BOOST_GETTER(&TestPropertyGroup::GetInt), new IntegerEditor());
- add_property<string>(PROPERTY_STRING_2, "PropertyString2 description", BOOST_SETTER(&TestPropertyGroup::SetPropertyString2), BOOST_GETTER(&TestPropertyGroup::GetPropertyString2), new StringEditor());
- add_property<bool>(PROPERTY_BOOL, "PropertyBool description", BOOST_SETTER(&TestPropertyGroup::SetBool), BOOST_GETTER(&TestPropertyGroup::GetBool), new BoolEditor());
+ add_property(PROPERTY_STRING_1, "PropertyString1 description", BOOST_SETTER_NONE, BOOST_GETTER(&TestPropertyGroup::GetPropertyString1), new StringEditor());
+ add_property(PROPERTY_FLOAT_1, "PropertyFloat1 description", BOOST_SETTER(&TestPropertyGroup::SetFloat), BOOST_GETTER(&TestPropertyGroup::GetFloat), new FloatEditor());
+ add_property(PROPERTY_INT_1, "PropertyInt1 description", BOOST_SETTER(&TestPropertyGroup::SetInt), BOOST_GETTER(&TestPropertyGroup::GetInt), new IntegerEditor());
+ add_property(PROPERTY_STRING_2, "PropertyString2 description", BOOST_SETTER(&TestPropertyGroup::SetPropertyString2), BOOST_GETTER(&TestPropertyGroup::GetPropertyString2), new StringEditor());
+ add_property(PROPERTY_BOOL, "PropertyBool description", BOOST_SETTER(&TestPropertyGroup::SetBool), BOOST_GETTER(&TestPropertyGroup::GetBool), new BoolEditor());
         
- add_property<float>(PROPERTY_FLOAT_1_VAR, "PropertyFloatVar description", BOOST_SETTER_VAR(m_fVarFloat1), BOOST_GETTER_VAR(m_fVarFloat1), new FloatEditor());
- add_property<int>(PROPERTY_INT_1_VAR, "PropertyIntVar description", BOOST_SETTER_VAR(m_iVarInt1), BOOST_GETTER_VAR(m_iVarInt1), new IntegerEditor());
- add_property<string>(PROPERTY_STRING_2_VAR, "PropertyStringVar description", BOOST_SETTER_VAR(m_strVarString2), BOOST_GETTER_VAR(m_strVarString2), new StringEditor());
- add_property<bool>(PROPERTY_BOOL_VAR, "PropertyBoolVar description", BOOST_SETTER_VAR(m_bVarBool), BOOST_GETTER_VAR(m_bVarBool), new BoolEditor());
+ add_property(PROPERTY_FLOAT_1_VAR, "PropertyFloatVar description", BOOST_SETTER_VAR(m_fVarFloat1), BOOST_GETTER_VAR(m_fVarFloat1), new FloatEditor());
+ add_property(PROPERTY_INT_1_VAR, "PropertyIntVar description", BOOST_SETTER_VAR(m_iVarInt1), BOOST_GETTER_VAR(m_iVarInt1), new IntegerEditor());
+ add_property(PROPERTY_STRING_2_VAR, "PropertyStringVar description", BOOST_SETTER_VAR(m_strVarString2), BOOST_GETTER_VAR(m_strVarString2), new StringEditor());
+ add_property(PROPERTY_BOOL_VAR, "PropertyBoolVar description", BOOST_SETTER_VAR(m_bVarBool), BOOST_GETTER_VAR(m_bVarBool), new BoolEditor());
         }
 #if defined(BOOST_MSVC)
     #pragma warning(pop)
@@ -172,9 +172,9 @@
 public:
         TestPropertyGroup_1() : property_group( PROPERTY_GROUP_NAME, NULL )
         {
- add_property<float>(PROPERTY_FLOAT_1, "PropertyFloat1 description", BOOST_SETTER(&TestPropertyGroup_1::SetFloat), BOOST_GETTER(&TestPropertyGroup_1::GetFloat), new FloatEditor() );
- add_property<int>(PROPERTY_INT_1, "PropertyInt1 description", BOOST_SETTER(&TestPropertyGroup_1::SetInt), BOOST_GETTER(&TestPropertyGroup_1::GetInt), new IntegerEditor());
- add_property<string>(PROPERTY_STRING_2, "PropertyString2 description", BOOST_SETTER(&TestPropertyGroup_1::SetPropertyString2), BOOST_GETTER(&TestPropertyGroup_1::GetPropertyString2), new StringEditor() );
+ add_property(PROPERTY_FLOAT_1, "PropertyFloat1 description", BOOST_SETTER(&TestPropertyGroup_1::SetFloat), BOOST_GETTER(&TestPropertyGroup_1::GetFloat), new FloatEditor() );
+ add_property(PROPERTY_INT_1, "PropertyInt1 description", BOOST_SETTER(&TestPropertyGroup_1::SetInt), BOOST_GETTER(&TestPropertyGroup_1::GetInt), new IntegerEditor());
+ add_property(PROPERTY_STRING_2, "PropertyString2 description", BOOST_SETTER(&TestPropertyGroup_1::SetPropertyString2), BOOST_GETTER(&TestPropertyGroup_1::GetPropertyString2), new StringEditor() );
         }
 
 private:
@@ -200,9 +200,9 @@
 public:
         TestPropertyGroup_2() : property_group( PROPERTY_GROUP_NAME, NULL )
         {
- add_property<float>(PROPERTY_FLOAT_1, "PropertyFloat1 description", BOOST_SETTER(&TestPropertyGroup_2::SetFloat), BOOST_GETTER(&TestPropertyGroup_2::GetFloat), new FloatEditor() );
- add_property<int>(PROPERTY_INT_1, "PropertyInt1 description", BOOST_SETTER(&TestPropertyGroup_2::SetInt), BOOST_GETTER(&TestPropertyGroup_2::GetInt), new IntegerEditor() );
- add_property<string>(PROPERTY_STRING_2, "PropertyString2 description", BOOST_SETTER(&TestPropertyGroup_2::SetPropertyString2), BOOST_GETTER(&TestPropertyGroup_2::GetPropertyString2), new StringEditor() );
+ add_property(PROPERTY_FLOAT_1, "PropertyFloat1 description", BOOST_SETTER(&TestPropertyGroup_2::SetFloat), BOOST_GETTER(&TestPropertyGroup_2::GetFloat), new FloatEditor() );
+ add_property(PROPERTY_INT_1, "PropertyInt1 description", BOOST_SETTER(&TestPropertyGroup_2::SetInt), BOOST_GETTER(&TestPropertyGroup_2::GetInt), new IntegerEditor() );
+ add_property(PROPERTY_STRING_2, "PropertyString2 description", BOOST_SETTER(&TestPropertyGroup_2::SetPropertyString2), BOOST_GETTER(&TestPropertyGroup_2::GetPropertyString2), new StringEditor() );
         }
 
 private:
@@ -226,9 +226,9 @@
 public:
         TestPropertyChildGroup_1( property_group *pParentGroup) : property_group( PROPERTY_GROUP_CHILD_NAME, pParentGroup )
         {
- add_property<float>(PROPERTY_FLOAT_1, "PropertyFloat1 description", BOOST_SETTER(&TestPropertyChildGroup_1::SetFloat), BOOST_GETTER(&TestPropertyChildGroup_1::GetFloat), new FloatEditor());
- add_property<int>(PROPERTY_INT_1, "PropertyInt1 description", BOOST_SETTER(&TestPropertyChildGroup_1::SetInt), BOOST_GETTER(&TestPropertyChildGroup_1::GetInt), new IntegerEditor() );
- add_property<string>(PROPERTY_STRING_2, "PropertyString2 description", BOOST_SETTER(&TestPropertyChildGroup_1::SetPropertyString2), BOOST_GETTER(&TestPropertyChildGroup_1::GetPropertyString2), new StringEditor());
+ add_property(PROPERTY_FLOAT_1, "PropertyFloat1 description", BOOST_SETTER(&TestPropertyChildGroup_1::SetFloat), BOOST_GETTER(&TestPropertyChildGroup_1::GetFloat), new FloatEditor());
+ add_property(PROPERTY_INT_1, "PropertyInt1 description", BOOST_SETTER(&TestPropertyChildGroup_1::SetInt), BOOST_GETTER(&TestPropertyChildGroup_1::GetInt), new IntegerEditor() );
+ add_property(PROPERTY_STRING_2, "PropertyString2 description", BOOST_SETTER(&TestPropertyChildGroup_1::SetPropertyString2), BOOST_GETTER(&TestPropertyChildGroup_1::GetPropertyString2), new StringEditor());
         }
 
 private:
@@ -253,10 +253,10 @@
 #endif
         TestPropertyGroup_3() : property_group( PROPERTY_GROUP_NAME, NULL ), m_child1( this ), m_child2( this )
         {
- add_property<float>(PROPERTY_FLOAT_1, "PropertyFloat1 description", BOOST_SETTER(&TestPropertyGroup_3::SetFloat), BOOST_GETTER(&TestPropertyGroup_3::GetFloat), new FloatEditor() );
- add_property<int>(PROPERTY_INT_1, "PropertyInt1 description", BOOST_SETTER(&TestPropertyGroup_3::SetInt), BOOST_GETTER(&TestPropertyGroup_3::GetInt), new IntegerEditor());
- add_property<string>(PROPERTY_STRING_2, "PropertyString2 description", BOOST_SETTER(&TestPropertyGroup_3::SetPropertyString2), BOOST_GETTER(&TestPropertyGroup_3::GetPropertyString2), new StringEditor());
- add_property<bool>(PROPERTY_BOOL, "PropertyBool description", BOOST_SETTER(&TestPropertyGroup_3::SetBool), BOOST_GETTER(&TestPropertyGroup_3::GetBool), new BoolEditor());
+ add_property(PROPERTY_FLOAT_1, "PropertyFloat1 description", BOOST_SETTER(&TestPropertyGroup_3::SetFloat), BOOST_GETTER(&TestPropertyGroup_3::GetFloat), new FloatEditor() );
+ add_property(PROPERTY_INT_1, "PropertyInt1 description", BOOST_SETTER(&TestPropertyGroup_3::SetInt), BOOST_GETTER(&TestPropertyGroup_3::GetInt), new IntegerEditor());
+ add_property(PROPERTY_STRING_2, "PropertyString2 description", BOOST_SETTER(&TestPropertyGroup_3::SetPropertyString2), BOOST_GETTER(&TestPropertyGroup_3::GetPropertyString2), new StringEditor());
+ add_property(PROPERTY_BOOL, "PropertyBool description", BOOST_SETTER(&TestPropertyGroup_3::SetBool), BOOST_GETTER(&TestPropertyGroup_3::GetBool), new BoolEditor());
         }
 #if defined(BOOST_MSVC)
     #pragma warning(pop)
@@ -314,12 +314,12 @@
 #endif
         TestPropertyGroup_4() : property_group( PROPERTY_GROUP_NAME, NULL ), m_child1( this ), m_child2( this )
         {
- add_property<float>(PROPERTY_FLOAT_1, "PropertyFloat1 description", BOOST_SETTER(&TestPropertyGroup_4::SetFloat), BOOST_GETTER(&TestPropertyGroup_4::GetFloat), new FloatEditor() );
- add_property<float>(PROPERTY_FLOAT_2, "PropertyFloat2 description", BOOST_SETTER(&TestPropertyGroup_4::SetFloat2), BOOST_GETTER(&TestPropertyGroup_4::GetFloat2), new FloatEditor(FLOAT_LOW, FLOAT_HIGH, FLOAT_INCREMENT, Tracker ) );
- add_property<int>(PROPERTY_INT_1, "PropertyInt1 description", BOOST_SETTER(&TestPropertyGroup_4::SetInt), BOOST_GETTER(&TestPropertyGroup_4::GetInt), new IntegerEditor(INT_LOW, INT_HIGH, INT_INCREMENT, DropDown));
- add_property<int>(PROPERTY_INT_2, "PropertyInt2 description", BOOST_SETTER(&TestPropertyGroup_4::SetInt), BOOST_GETTER(&TestPropertyGroup_4::GetInt), new IntegerEditor());
- add_property<string>(PROPERTY_STRING_2, "PropertyString2 description", BOOST_SETTER(&TestPropertyGroup_4::SetPropertyString2), BOOST_GETTER(&TestPropertyGroup_4::GetPropertyString2), new StringEditor());
- add_property<bool>(PROPERTY_BOOL, "PropertyBool description", BOOST_SETTER(&TestPropertyGroup_4::SetBool), BOOST_GETTER(&TestPropertyGroup_4::GetBool), new BoolEditor());
+ add_property(PROPERTY_FLOAT_1, "PropertyFloat1 description", BOOST_SETTER(&TestPropertyGroup_4::SetFloat), BOOST_GETTER(&TestPropertyGroup_4::GetFloat), new FloatEditor() );
+ add_property(PROPERTY_FLOAT_2, "PropertyFloat2 description", BOOST_SETTER(&TestPropertyGroup_4::SetFloat2), BOOST_GETTER(&TestPropertyGroup_4::GetFloat2), new FloatEditor(FLOAT_LOW, FLOAT_HIGH, FLOAT_INCREMENT, Tracker ) );
+ add_property(PROPERTY_INT_1, "PropertyInt1 description", BOOST_SETTER(&TestPropertyGroup_4::SetInt), BOOST_GETTER(&TestPropertyGroup_4::GetInt), new IntegerEditor(INT_LOW, INT_HIGH, INT_INCREMENT, DropDown));
+ add_property(PROPERTY_INT_2, "PropertyInt2 description", BOOST_SETTER(&TestPropertyGroup_4::SetInt), BOOST_GETTER(&TestPropertyGroup_4::GetInt), new IntegerEditor());
+ add_property(PROPERTY_STRING_2, "PropertyString2 description", BOOST_SETTER(&TestPropertyGroup_4::SetPropertyString2), BOOST_GETTER(&TestPropertyGroup_4::GetPropertyString2), new StringEditor());
+ add_property(PROPERTY_BOOL, "PropertyBool description", BOOST_SETTER(&TestPropertyGroup_4::SetBool), BOOST_GETTER(&TestPropertyGroup_4::GetBool), new BoolEditor());
         }
 #if defined(BOOST_MSVC)
     #pragma warning(pop)
@@ -357,14 +357,14 @@
 public:
         TestPropertyGroup_5() : property_group( PROPERTY_GROUP_NAME, NULL )
         {
- add_property<float>(PROPERTY_FLOAT_1, "PropertyFloat1 description", BOOST_SETTER(&TestPropertyGroup_5::SetFloat), BOOST_GETTER(&TestPropertyGroup_5::GetFloat), new FloatEditor() );
- add_property<int>(PROPERTY_INT_1, "PropertyInt1 description", BOOST_SETTER(&TestPropertyGroup_5::SetInt), BOOST_GETTER(&TestPropertyGroup_5::GetInt), NULL);
- add_property<string>(PROPERTY_STRING_2, "PropertyString2 description", BOOST_SETTER(&TestPropertyGroup_5::SetPropertyString2), BOOST_GETTER(&TestPropertyGroup_5::GetPropertyString2), new StringEditor() );
- add_property<bool>(PROPERTY_BOOL, "PropertyBool description", BOOST_SETTER(&TestPropertyGroup_5::SetBool), BOOST_GETTER(&TestPropertyGroup_5::GetBool), new BoolEditor());
- add_property<double>(PROPERTY_DOUBLE, "PropertyDouble description", BOOST_SETTER(&TestPropertyGroup_5::SetDouble), BOOST_GETTER(&TestPropertyGroup_5::GetDouble), new DoubleEditor() );
- add_property<double>(PROPERTY_DOUBLE_2, "PropertyDouble2 description", BOOST_SETTER(&TestPropertyGroup_5::SetDouble2), BOOST_GETTER(&TestPropertyGroup_5::GetDouble2), new DoubleEditor(DOUBLE_LOW, DOUBLE_HIGH, DOUBLE_INCREMENT, Tracker) );
+ add_property(PROPERTY_FLOAT_1, "PropertyFloat1 description", BOOST_SETTER(&TestPropertyGroup_5::SetFloat), BOOST_GETTER(&TestPropertyGroup_5::GetFloat), new FloatEditor() );
+ add_property(PROPERTY_INT_1, "PropertyInt1 description", BOOST_SETTER(&TestPropertyGroup_5::SetInt), BOOST_GETTER(&TestPropertyGroup_5::GetInt), NULL);
+ add_property(PROPERTY_STRING_2, "PropertyString2 description", BOOST_SETTER(&TestPropertyGroup_5::SetPropertyString2), BOOST_GETTER(&TestPropertyGroup_5::GetPropertyString2), new StringEditor() );
+ add_property(PROPERTY_BOOL, "PropertyBool description", BOOST_SETTER(&TestPropertyGroup_5::SetBool), BOOST_GETTER(&TestPropertyGroup_5::GetBool), new BoolEditor());
+ add_property(PROPERTY_DOUBLE, "PropertyDouble description", BOOST_SETTER(&TestPropertyGroup_5::SetDouble), BOOST_GETTER(&TestPropertyGroup_5::GetDouble), new DoubleEditor() );
+ add_property(PROPERTY_DOUBLE_2, "PropertyDouble2 description", BOOST_SETTER(&TestPropertyGroup_5::SetDouble2), BOOST_GETTER(&TestPropertyGroup_5::GetDouble2), new DoubleEditor(DOUBLE_LOW, DOUBLE_HIGH, DOUBLE_INCREMENT, Tracker) );
 
- add_property<double>(PROPERTY_DOUBLE_VAR, "PropertyDoubleVar description", BOOST_SETTER_VAR(m_dVarDouble), BOOST_GETTER_VAR(m_dVarDouble), new BoolEditor());
+ add_property(PROPERTY_DOUBLE_VAR, "PropertyDoubleVar description", BOOST_SETTER_VAR(m_dVarDouble), BOOST_GETTER_VAR(m_dVarDouble), new BoolEditor());
         }
 
         void add_category( const std::string &category_name )
@@ -373,20 +373,20 @@
         }
 
         
- template<typename Value_Type>
+ template<typename Setter, typename Getter>
         void add_property( std::string name,
                                            std::string description,
- boost::function<void (const Value_Type&)> setter,
- boost::function<Value_Type ()> getter )
+ Setter setter,
+ Getter getter )
         {
                 property_group::add_property( name, description, setter, getter );
         }
 
- template<typename Value_Type>
+ template<typename Setter, typename Getter>
         void add_property( std::string name,
                                            std::string description,
- boost::function<void (const Value_Type&)> setter,
- boost::function<Value_Type ()> getter,
+ Setter setter,
+ Getter getter,
                                            Editor *pEditor )
         {
                 property_group::add_property( name, description, setter, getter, pEditor );
@@ -430,18 +430,12 @@
 #endif
         TestAutoGeneratedDesigners() : property_group( PROPERTY_GROUP_NAME, NULL )
         {
- add_property<string>(PROPERTY_STRING_1, "PropertyString1 description",
- BOOST_SETTER_NONE, BOOST_GETTER(&TestAutoGeneratedDesigners::GetPropertyString1));
- add_property<float> (PROPERTY_FLOAT_1, "PropertyFloat1 description",
- BOOST_SETTER(&TestAutoGeneratedDesigners::SetFloat), BOOST_GETTER(&TestAutoGeneratedDesigners::GetFloat));
- add_property<int> (PROPERTY_INT_1, "PropertyInt1 description",
- BOOST_SETTER(&TestAutoGeneratedDesigners::SetInt), BOOST_GETTER(&TestAutoGeneratedDesigners::GetInt));
- add_property<string>(PROPERTY_STRING_2, "PropertyString2 description",
- BOOST_SETTER(&TestAutoGeneratedDesigners::SetPropertyString2), BOOST_GETTER(&TestAutoGeneratedDesigners::GetPropertyString2));
- add_property<bool> (PROPERTY_BOOL, "PropertyBool description",
- BOOST_SETTER(&TestAutoGeneratedDesigners::SetBool), BOOST_GETTER(&TestAutoGeneratedDesigners::GetBool));
- add_property<double>(PROPERTY_DOUBLE, "PropertyFloat1 description",
- BOOST_SETTER(&TestAutoGeneratedDesigners::SetDouble), BOOST_GETTER(&TestAutoGeneratedDesigners::GetDouble));
+ add_property(PROPERTY_STRING_1, "PropertyString1 description", BOOST_SETTER_NONE, BOOST_GETTER(&TestAutoGeneratedDesigners::GetPropertyString1));
+ add_property(PROPERTY_FLOAT_1, "PropertyFloat1 description", BOOST_SETTER(&TestAutoGeneratedDesigners::SetFloat), BOOST_GETTER(&TestAutoGeneratedDesigners::GetFloat));
+ add_property(PROPERTY_INT_1, "PropertyInt1 description", BOOST_SETTER(&TestAutoGeneratedDesigners::SetInt), BOOST_GETTER(&TestAutoGeneratedDesigners::GetInt));
+ add_property(PROPERTY_STRING_2, "PropertyString2 description", BOOST_SETTER(&TestAutoGeneratedDesigners::SetPropertyString2), BOOST_GETTER(&TestAutoGeneratedDesigners::GetPropertyString2));
+ add_property(PROPERTY_BOOL, "PropertyBool description", BOOST_SETTER(&TestAutoGeneratedDesigners::SetBool), BOOST_GETTER(&TestAutoGeneratedDesigners::GetBool));
+ add_property(PROPERTY_DOUBLE, "PropertyFloat1 description", BOOST_SETTER(&TestAutoGeneratedDesigners::SetDouble), BOOST_GETTER(&TestAutoGeneratedDesigners::GetDouble));
 
         }
 #if defined(BOOST_MSVC)
@@ -473,7 +467,7 @@
 public:
         TestUpDownGroup() : property_group( PROPERTY_GROUP_NAME, NULL )
         {
- add_property<float>(PROPERTY_FLOAT_1, "PropertyFloat1 description", BOOST_SETTER(&TestUpDownGroup::SetFloat), BOOST_GETTER(&TestUpDownGroup::GetFloat), new FloatEditor(-1000,1000,1,UpDown) );
+ add_property(PROPERTY_FLOAT_1, "PropertyFloat1 description", BOOST_SETTER(&TestUpDownGroup::SetFloat), BOOST_GETTER(&TestUpDownGroup::GetFloat), new FloatEditor(-1000,1000,1,UpDown) );
         }
 
 private:
@@ -533,10 +527,10 @@
             m_iInt1 = 365;
             m_strString2 = "test value";
 
- add_property<string>(PROPERTY_NAME, "Name", BOOST_SETTER_NONE, BOOST_GETTER(&TestPropertySerializer::GetName), new FloatEditor());
- add_property<float>(PROPERTY_FLOAT_1, "PropertyFloat1 description", BOOST_SETTER(&TestPropertySerializer::SetFloat), BOOST_GETTER(&TestPropertySerializer::GetFloat), new FloatEditor());
- add_property<int>(PROPERTY_INT_1, "PropertyInt1 description", BOOST_SETTER(&TestPropertySerializer::SetInt), BOOST_GETTER(&TestPropertySerializer::GetInt), new IntegerEditor() );
- add_property<string>(PROPERTY_STRING_2, "PropertyString2 description", BOOST_SETTER(&TestPropertySerializer::SetPropertyString2), BOOST_GETTER(&TestPropertySerializer::GetPropertyString2), new StringEditor());
+ add_property(PROPERTY_NAME, "Name", BOOST_SETTER_NONE, BOOST_GETTER(&TestPropertySerializer::GetName), new FloatEditor());
+ add_property(PROPERTY_FLOAT_1, "PropertyFloat1 description", BOOST_SETTER(&TestPropertySerializer::SetFloat), BOOST_GETTER(&TestPropertySerializer::GetFloat), new FloatEditor());
+ add_property(PROPERTY_INT_1, "PropertyInt1 description", BOOST_SETTER(&TestPropertySerializer::SetInt), BOOST_GETTER(&TestPropertySerializer::GetInt), new IntegerEditor() );
+ add_property(PROPERTY_STRING_2, "PropertyString2 description", BOOST_SETTER(&TestPropertySerializer::SetPropertyString2), BOOST_GETTER(&TestPropertySerializer::GetPropertyString2), new StringEditor());
         }
 
 private:

Modified: sandbox/pinhole/libs/pinhole/test/TestPropertyGroupWrapper.cpp
==============================================================================
--- sandbox/pinhole/libs/pinhole/test/TestPropertyGroupWrapper.cpp (original)
+++ sandbox/pinhole/libs/pinhole/test/TestPropertyGroupWrapper.cpp 2007-08-23 23:28:10 EDT (Thu, 23 Aug 2007)
@@ -23,7 +23,7 @@
         const Editor *pEditor;
 
         // Test Standard Creation
- wrapper.add_property<bool>(PROPERTY_BOOL, "PropertyBool description", boost::bind(&TestPropertyGroup_4::SetBool, &baseObject, _1), boost::bind(&TestPropertyGroup_4::GetBool, &baseObject), new BoolEditor());
+ wrapper.add_property(PROPERTY_BOOL, "PropertyBool description", boost::bind(&TestPropertyGroup_4::SetBool, &baseObject, _1), boost::bind(&TestPropertyGroup_4::GetBool, &baseObject), new BoolEditor());
 
         wrapper.set_as_string( PROPERTY_BOOL, BOOL_FALSE );
         BOOST_CHECK( wrapper.get_as_string( PROPERTY_BOOL ) == BOOL_FALSE );
@@ -38,7 +38,7 @@
         // Test Auto-Generated Designer Creation
         property_group_wrapper wrapperAutoGenDesigner("test_wrapper", &baseObject);
 
- wrapperAutoGenDesigner.add_property<bool>(PROPERTY_BOOL, "PropertyBool description", boost::bind(&TestPropertyGroup_4::SetBool, &baseObject, _1), boost::bind(&TestPropertyGroup_4::GetBool, &baseObject) );
+ wrapperAutoGenDesigner.add_property(PROPERTY_BOOL, "PropertyBool description", boost::bind(&TestPropertyGroup_4::SetBool, &baseObject, _1), boost::bind(&TestPropertyGroup_4::GetBool, &baseObject) );
 
         pEditor = wrapperAutoGenDesigner.get_metadata(PROPERTY_BOOL);
         BOOST_CHECK( NULL != dynamic_cast<const BoolEditor*>(pEditor) );
@@ -51,7 +51,7 @@
         const Editor *pEditor;
 
         // Test Standard Creation
- wrapper.add_property<double>(PROPERTY_DOUBLE, "PropertyDouble description", boost::bind(&TestPropertyGroup_5::SetDouble, &baseObject, _1), boost::bind(&TestPropertyGroup_5::GetDouble, &baseObject), new DoubleEditor() );
+ wrapper.add_property(PROPERTY_DOUBLE, "PropertyDouble description", boost::bind(&TestPropertyGroup_5::SetDouble, &baseObject, _1), boost::bind(&TestPropertyGroup_5::GetDouble, &baseObject), new DoubleEditor() );
 
         double dValue;
         wrapper.set_as_string( PROPERTY_DOUBLE, PROPERTY_DOUBLE_STRING_VALUE );
@@ -65,7 +65,7 @@
         // Test Auto-Generated Designer Creation
         property_group_wrapper wrapperAutoGenDesigner("test_wrapper", &baseObject);
 
- wrapperAutoGenDesigner.add_property<double>(PROPERTY_DOUBLE, "PropertyDouble description", boost::bind(&TestPropertyGroup_5::SetDouble, &baseObject, _1), boost::bind(&TestPropertyGroup_5::GetDouble, &baseObject) );
+ wrapperAutoGenDesigner.add_property(PROPERTY_DOUBLE, "PropertyDouble description", boost::bind(&TestPropertyGroup_5::SetDouble, &baseObject, _1), boost::bind(&TestPropertyGroup_5::GetDouble, &baseObject) );
 
         pEditor = wrapperAutoGenDesigner.get_metadata(PROPERTY_DOUBLE);
         BOOST_CHECK( NULL != dynamic_cast<const DoubleEditor*>(pEditor) );
@@ -78,7 +78,7 @@
         const Editor *pEditor;
 
         // Test Standard Creation
- wrapper.add_property<float>(PROPERTY_FLOAT_1, "PropertyFloat1 description", boost::bind(&TestPropertyGroup_4::SetFloat, &baseObject, _1), boost::bind(&TestPropertyGroup_4::GetFloat, &baseObject), new FloatEditor() );
+ wrapper.add_property(PROPERTY_FLOAT_1, "PropertyFloat1 description", boost::bind(&TestPropertyGroup_4::SetFloat, &baseObject, _1), boost::bind(&TestPropertyGroup_4::GetFloat, &baseObject), new FloatEditor() );
 
         float fValue;
         wrapper.set_as_string( PROPERTY_FLOAT_1, PROPERTY_FLOAT_1_STRING_VALUE );
@@ -92,7 +92,7 @@
         // Test Auto-Generated Designer Creation
         property_group_wrapper wrapperAutoGenDesigner("test_wrapper", &baseObject);
 
- wrapperAutoGenDesigner.add_property<float>(PROPERTY_FLOAT_1, "PropertyFloat1 description", boost::bind(&TestPropertyGroup_4::SetFloat, &baseObject, _1), boost::bind(&TestPropertyGroup_4::GetFloat, &baseObject) );
+ wrapperAutoGenDesigner.add_property(PROPERTY_FLOAT_1, "PropertyFloat1 description", boost::bind(&TestPropertyGroup_4::SetFloat, &baseObject, _1), boost::bind(&TestPropertyGroup_4::GetFloat, &baseObject) );
 
         pEditor = wrapperAutoGenDesigner.get_metadata(PROPERTY_FLOAT_1);
         BOOST_CHECK( NULL != dynamic_cast<const FloatEditor*>(pEditor) );
@@ -105,7 +105,7 @@
         const Editor *pEditor;
 
         // Test Standard Creation
- wrapper.add_property<int>(PROPERTY_INT_1, "PropertyInt1 description", boost::bind(&TestPropertyGroup_4::SetInt, &baseObject, _1), boost::bind(&TestPropertyGroup_4::GetInt, &baseObject), new IntegerEditor(INT_LOW, INT_HIGH, INT_INCREMENT, DropDown));
+ wrapper.add_property(PROPERTY_INT_1, "PropertyInt1 description", boost::bind(&TestPropertyGroup_4::SetInt, &baseObject, _1), boost::bind(&TestPropertyGroup_4::GetInt, &baseObject), new IntegerEditor(INT_LOW, INT_HIGH, INT_INCREMENT, DropDown));
 
         int iValue;
         wrapper.set_as_string( PROPERTY_INT_1, PROPERTY_INT_1_STRING_VALUE );
@@ -119,7 +119,7 @@
         // Test Auto-Generated Designer Creation
         property_group_wrapper wrapperAutoGenDesigner("test_wrapper", &baseObject);
 
- wrapperAutoGenDesigner.add_property<int>(PROPERTY_INT_1, "PropertyInt1 description", boost::bind(&TestPropertyGroup_4::SetInt, &baseObject, _1), boost::bind(&TestPropertyGroup_4::GetInt, &baseObject) );
+ wrapperAutoGenDesigner.add_property(PROPERTY_INT_1, "PropertyInt1 description", boost::bind(&TestPropertyGroup_4::SetInt, &baseObject, _1), boost::bind(&TestPropertyGroup_4::GetInt, &baseObject) );
 
         pEditor = wrapperAutoGenDesigner.get_metadata(PROPERTY_INT_1);
         BOOST_CHECK( NULL != dynamic_cast<const IntegerEditor*>(pEditor) );
@@ -132,7 +132,7 @@
         const Editor *pEditor;
 
         // Test Standard Creation
- wrapper.add_property<string>(PROPERTY_STRING_2, "PropertyString2 description", boost::bind(&TestPropertyGroup::SetPropertyString2, &baseObject, _1), boost::bind(&TestPropertyGroup::GetPropertyString2, &baseObject), new StringEditor());
+ wrapper.add_property(PROPERTY_STRING_2, "PropertyString2 description", boost::bind(&TestPropertyGroup::SetPropertyString2, &baseObject, _1), boost::bind(&TestPropertyGroup::GetPropertyString2, &baseObject), new StringEditor());
 
         wrapper.set_as_string( PROPERTY_STRING_2, PROPERTY_STRING_2_VALUE );
         BOOST_CHECK( PROPERTY_STRING_2_VALUE == wrapper.get_as_string( PROPERTY_STRING_2) );
@@ -146,7 +146,7 @@
         // Test Auto-Generated Designer Creation
         property_group_wrapper wrapperAutoGenDesigner("test_wrapper", &baseObject);
 
- wrapperAutoGenDesigner.add_property<string>(PROPERTY_STRING_2, "PropertyString2 description", boost::bind(&TestPropertyGroup::SetPropertyString2, &baseObject, _1), boost::bind(&TestPropertyGroup::GetPropertyString2, &baseObject) );
+ wrapperAutoGenDesigner.add_property(PROPERTY_STRING_2, "PropertyString2 description", boost::bind(&TestPropertyGroup::SetPropertyString2, &baseObject, _1), boost::bind(&TestPropertyGroup::GetPropertyString2, &baseObject) );
 
         pEditor = wrapperAutoGenDesigner.get_metadata(PROPERTY_STRING_2);
         BOOST_CHECK( NULL != dynamic_cast<const StringEditor*>(pEditor) );

Modified: sandbox/pinhole/libs/pinhole/test/TestPropertyGroups.cpp
==============================================================================
--- sandbox/pinhole/libs/pinhole/test/TestPropertyGroups.cpp (original)
+++ sandbox/pinhole/libs/pinhole/test/TestPropertyGroups.cpp 2007-08-23 23:28:10 EDT (Thu, 23 Aug 2007)
@@ -300,4 +300,6 @@
         
         BOOST_CHECK_EQUAL( testGroup.is_read_only(PROPERTY_STRING_1), true );
         BOOST_CHECK_EQUAL( testGroup.is_read_only(PROPERTY_FLOAT_1), false );
-}
\ No newline at end of file
+}
+
+// test throw on readonly set
\ No newline at end of file

Deleted: sandbox/pinhole/libs/pinhole/test/TestSerializer.cpp
==============================================================================
--- sandbox/pinhole/libs/pinhole/test/TestSerializer.cpp 2007-08-23 23:28:10 EDT (Thu, 23 Aug 2007)
+++ (empty file)
@@ -1,180 +0,0 @@
-#pragma once
-
-#define BOOST_TEST_MODULE PinholeLib
-#include <boost/test/unit_test.hpp>
-#include "TestClassesAndConstants.h"
-#include <boost/pinhole/PropertySerializer.h>
-#include <fstream>
-
-// I can hide these two line if I don't do everything in headers
-boost::shared_ptr<property_manager> property_manager::m_instance(new property_manager);
-event_source* event_source::m_instance = 0;
-
-#define FILE_PATH "C:\\TestOutput.xml"
-
-using namespace MscProperty;
-
-class PropertyManagerResetter : public property_manager
-{
-public:
- ~PropertyManagerResetter()
- {
- property_manager::DeleteInstance();
- }
-};
-
-BOOST_AUTO_TEST_CASE( TestSerializer_Serializer )
-{
- PropertyManagerResetter resetter;
-
- CoInitialize(NULL);
-
- TestPropertySerializer *pRootGroup = new TestPropertySerializer(NULL);
- TestPropertySerializer childGroup(pRootGroup);
-
- PropertySerializer serializer(FILE_PATH);
- serializer.Serialize();
- serializer.Deserialize();
-
- std::stringstream strToCompare;
- strToCompare << "<prop_serialization>" << std::endl
- << "<path value=\"/TestPropertySerializer.Name=aName\">" << std::endl
- << "<property name=\"Name\" value=\"aName\" />" << std::endl
- << "<property name=\"PropertyFloat1\" value=\"2.45\" />" << std::endl
- << "<property name=\"PropertyInt1\" value=\"365\" />" << std::endl
- << "<property name=\"PropertyString2\" value=\"BOOST_AUTO_TEST_CASE value\" />" << std::endl
- << "</path>" << std::endl
- << "<path value=\"/TestPropertySerializer.Name=aName/TestPropertySerializer.Name=aName\">" << std::endl
- << "<property name=\"Name\" value=\"aName\" />" << std::endl
- << "<property name=\"PropertyFloat1\" value=\"2.45\" />" << std::endl
- << "<property name=\"PropertyInt1\" value=\"365\" />" << std::endl
- << "<property name=\"PropertyString2\" value=\"BOOST_AUTO_TEST_CASE value\" />" << std::endl
- << "</path>" << std::endl
- << "</prop_serialization>";
-
- std::ifstream file(FILE_PATH);
-
- BOOST_CHECK(file.is_open());
- BOOST_CHECK(file.good());
-
- char c;
- stringstream toTest;
- while( file.get(c) )
- {
- toTest << c;
- }
-
- BOOST_CHECK_EQUAL( toTest.str(), strToCompare.str() );
-
- CoUninitialize();
-}
-
-BOOST_AUTO_TEST_CASE( TestSerializer_Deserializer )
-{
- PropertyManagerResetter resetter;
-
- CoInitialize(NULL);
-
- TestPropertySerializer *pRootGroup = new TestPropertySerializer(NULL);
- TestPropertySerializer childGroup(pRootGroup);
-
- PropertySerializer serializer(FILE_PATH);
- serializer.Serialize();
-
- // Setup changes in root object
-
- BOOST_CHECK_EQUAL( pRootGroup->testGroup.get_as_string(PROPERTY_FLOAT_1), "2.45");
- BOOST_CHECK_EQUAL( pRootGroup->testGroup.get_as_string(PROPERTY_INT_1), "365");
- BOOST_CHECK_EQUAL( pRootGroup->testGroup.get_as_string(PROPERTY_STRING_2), "BOOST_AUTO_TEST_CASE value");
-
- pRootGroup->testGroup.set_as_string(PROPERTY_FLOAT_1, "3.33");
- pRootGroup->testGroup.set_as_string(PROPERTY_INT_1, "567");
- pRootGroup->testGroup.set_as_string(PROPERTY_STRING_2, "a different string");
-
- BOOST_CHECK_EQUAL( pRootGroup->testGroup.get_as_string(PROPERTY_FLOAT_1), "3.33");
- BOOST_CHECK_EQUAL( pRootGroup->testGroup.get_as_string(PROPERTY_INT_1), "567");
- BOOST_CHECK_EQUAL( pRootGroup->testGroup.get_as_string(PROPERTY_STRING_2), "a different string");
-
- // Setup changes in child object
-
- BOOST_CHECK_EQUAL( childGroup.testGroup.get_as_string(PROPERTY_FLOAT_1), "2.45");
- BOOST_CHECK_EQUAL( childGroup.testGroup.get_as_string(PROPERTY_INT_1), "365");
- BOOST_CHECK_EQUAL( childGroup.testGroup.get_as_string(PROPERTY_STRING_2), "BOOST_AUTO_TEST_CASE value");
-
- childGroup.testGroup.set_as_string(PROPERTY_FLOAT_1, "3.33");
- childGroup.testGroup.set_as_string(PROPERTY_INT_1, "567");
- childGroup.testGroup.set_as_string(PROPERTY_STRING_2, "a different string");
-
- BOOST_CHECK_EQUAL( childGroup.testGroup.get_as_string(PROPERTY_FLOAT_1), "3.33");
- BOOST_CHECK_EQUAL( childGroup.testGroup.get_as_string(PROPERTY_INT_1), "567");
- BOOST_CHECK_EQUAL( childGroup.testGroup.get_as_string(PROPERTY_STRING_2), "a different string");
-
- // Deserialize
-
- serializer.Deserialize();
-
- // Validate everything is reset
-
- BOOST_CHECK_EQUAL( pRootGroup->testGroup.get_as_string(PROPERTY_FLOAT_1), "2.45");
- BOOST_CHECK_EQUAL( pRootGroup->testGroup.get_as_string(PROPERTY_INT_1), "365");
- BOOST_CHECK_EQUAL( pRootGroup->testGroup.get_as_string(PROPERTY_STRING_2), "BOOST_AUTO_TEST_CASE value");
-
- BOOST_CHECK_EQUAL( childGroup.testGroup.get_as_string(PROPERTY_FLOAT_1), "2.45");
- BOOST_CHECK_EQUAL( childGroup.testGroup.get_as_string(PROPERTY_INT_1), "365");
- BOOST_CHECK_EQUAL( childGroup.testGroup.get_as_string(PROPERTY_STRING_2), "BOOST_AUTO_TEST_CASE value");
-
- CoUninitialize();
-}
-
-BOOST_AUTO_TEST_CASE( TestSerializer_DeserializerWherePathEqualsMultipleGroups )
-{
- PropertyManagerResetter resetter;
-
- CoInitialize(NULL);
-
- TestPropertySerializer *pRootGroup = new TestPropertySerializer(NULL);
- TestPropertySerializer childGroup1(pRootGroup);
- TestPropertySerializer childGroup2(pRootGroup);
-
- PropertySerializer serializer(FILE_PATH);
- serializer.Serialize();
-
- // Setup changes in root object
-
- pRootGroup->testGroup.set_as_string(PROPERTY_FLOAT_1, "3.33");
- pRootGroup->testGroup.set_as_string(PROPERTY_INT_1, "567");
- pRootGroup->testGroup.set_as_string(PROPERTY_STRING_2, "a different string");
-
- // Setup changes in child object1
-
- childGroup1.testGroup.set_as_string(PROPERTY_FLOAT_1, "3.33");
- childGroup1.testGroup.set_as_string(PROPERTY_INT_1, "567");
- childGroup1.testGroup.set_as_string(PROPERTY_STRING_2, "a different string");
-
- // Setup changes in child object2
-
- childGroup2.testGroup.set_as_string(PROPERTY_FLOAT_1, "3.33");
- childGroup2.testGroup.set_as_string(PROPERTY_INT_1, "567");
- childGroup2.testGroup.set_as_string(PROPERTY_STRING_2, "a different string");
-
- // Deserialize
-
- serializer.Deserialize();
-
- // Validate that only the root item has reset. This is because the child groups
- // have matching paths and are thus ignored in deserialization.
-
- BOOST_CHECK_EQUAL( pRootGroup->testGroup.get_as_string(PROPERTY_FLOAT_1), "2.45");
- BOOST_CHECK_EQUAL( pRootGroup->testGroup.get_as_string(PROPERTY_INT_1), "365");
- BOOST_CHECK_EQUAL( pRootGroup->testGroup.get_as_string(PROPERTY_STRING_2), "BOOST_AUTO_TEST_CASE value");
-
- BOOST_CHECK_EQUAL( childGroup1.testGroup.get_as_string(PROPERTY_FLOAT_1), "3.33");
- BOOST_CHECK_EQUAL( childGroup1.testGroup.get_as_string(PROPERTY_INT_1), "567");
- BOOST_CHECK_EQUAL( childGroup1.testGroup.get_as_string(PROPERTY_STRING_2), "a different string");
-
- BOOST_CHECK_EQUAL( childGroup2.testGroup.get_as_string(PROPERTY_FLOAT_1), "3.33");
- BOOST_CHECK_EQUAL( childGroup2.testGroup.get_as_string(PROPERTY_INT_1), "567");
- BOOST_CHECK_EQUAL( childGroup2.testGroup.get_as_string(PROPERTY_STRING_2), "a different string");
-
- CoUninitialize();
-}
\ No newline at end of file


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk