Boost logo

Boost-Commit :

From: jmcintyre_at_[hidden]
Date: 2007-12-05 18:44:41


Author: jared
Date: 2007-12-05 18:44:39 EST (Wed, 05 Dec 2007)
New Revision: 41767
URL: http://svn.boost.org/trac/boost/changeset/41767

Log:
Add wstring support
Generalize metadata and get rid of the last straggling code that is specific to our system.
Removed:
   sandbox/pinhole/boost/pinhole/BoolEditor.hpp
   sandbox/pinhole/boost/pinhole/DoubleEditor.hpp
   sandbox/pinhole/boost/pinhole/Editor.hpp
   sandbox/pinhole/boost/pinhole/EditorTypeFinder.hpp
   sandbox/pinhole/boost/pinhole/FloatEditor.hpp
   sandbox/pinhole/boost/pinhole/IntegerEditor.hpp
   sandbox/pinhole/boost/pinhole/StringEditor.hpp
   sandbox/pinhole/boost/pinhole/property_group_wrapper.hpp
   sandbox/pinhole/libs/pinhole/test/TestClassesAndConstants.hpp
   sandbox/pinhole/libs/pinhole/test/UtilityMisc.hpp
   sandbox/pinhole/libs/pinhole/test/test_property_group_wrapper.cpp
Text files modified:
   sandbox/pinhole/boost/pinhole/action_info.hpp | 9 -
   sandbox/pinhole/boost/pinhole/main.cpp | 22 +--
   sandbox/pinhole/boost/pinhole/property_group.hpp | 147 +++++++++++++++------------
   sandbox/pinhole/boost/pinhole/property_info.hpp | 211 +++++++++++++++++++++++++++++++++------
   sandbox/pinhole/libs/pinhole/test/Jamfile.v2 | 1
   sandbox/pinhole/libs/pinhole/test/test_actions.cpp | 41 +++++++
   sandbox/pinhole/libs/pinhole/test/test_bool_properties.cpp | 88 ++++++++++++++--
   sandbox/pinhole/libs/pinhole/test/test_double_properties.cpp | 27 +++-
   sandbox/pinhole/libs/pinhole/test/test_float_properties.cpp | 25 +++-
   sandbox/pinhole/libs/pinhole/test/test_integer_properties.cpp | 21 ++-
   sandbox/pinhole/libs/pinhole/test/test_property_groups.cpp | 207 +++++++++++++++++++++++++++++----------
   sandbox/pinhole/libs/pinhole/test/test_string_properties.cpp | 63 ++++++++++-
   12 files changed, 635 insertions(+), 227 deletions(-)

Deleted: sandbox/pinhole/boost/pinhole/BoolEditor.hpp
==============================================================================
--- sandbox/pinhole/boost/pinhole/BoolEditor.hpp 2007-12-05 18:44:39 EST (Wed, 05 Dec 2007)
+++ (empty file)
@@ -1,35 +0,0 @@
-// Pinhole BoolEditor.hpp file
-//
-// Copyright Jared McIntyre 2007.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef BOOST_BOOLEDITOR
-#define BOOST_BOOLEDITOR
-
-#include "Editor.hpp"
-
-namespace boost { namespace pinhole
-{
- class BoolEditor : public Editor
- {
- public:
- BoolEditor(EditorControlType controlType=Radio)
- {
- m_UItype = controlType;
- }
-
- ~BoolEditor() {;}
-
- /**
- * Retrieves the type of the property for the editor.
- */
- EditorPropertyType getEditorPropertyType() const
- {
- return( BooleanType );
- }
- };
-}}
-
-#endif // include guard
\ No newline at end of file

Deleted: sandbox/pinhole/boost/pinhole/DoubleEditor.hpp
==============================================================================
--- sandbox/pinhole/boost/pinhole/DoubleEditor.hpp 2007-12-05 18:44:39 EST (Wed, 05 Dec 2007)
+++ (empty file)
@@ -1,84 +0,0 @@
-// Pinhole DoubleEditor.hpp file
-//
-// Copyright Jared McIntyre 2007.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef BOOST_DOUBLEEDITOR
-#define BOOST_DOUBLEEDITOR
-
-#include "Editor.hpp"
-
-namespace boost { namespace pinhole
-{
- class DoubleEditor : public Editor
- {
- public:
- DoubleEditor()
- {
- m_UItype = EditBox;
- }
-
- DoubleEditor( double dLowRange,
- double dHighRange,
- double dIncrement=0.5,
- EditorControlType controlType=EditBox ) :
- m_dLowRange( dLowRange ),
- m_dHighRange( dHighRange ),
- m_dIncrement( dIncrement ),
- m_bHasRange( true )
- {
- m_UItype = controlType;
- }
-
-
- ~DoubleEditor() {;}
-
- /**
- * Retrieves the low range of the property for the editor.
- */
- double getLowRange() const
- {
- return( m_dLowRange );
- }
-
- /**
- * Retrieves the high range of the property for the editor.
- */
- double getHighRange() const
- {
- return( m_dHighRange );
- }
-
- /**
- * Retrieves the increment of the property for the editor.
- */
- double getIncrement() const
- {
- return( m_dIncrement );
- }
-
- /**
- * Retrieves the flag to use range of the property for the editor.
- */
- bool UseRange() const
- {
- return( m_bHasRange );
- }
-
- /**
- * Retrieves the type of the property for the editor.
- */
- EditorPropertyType getEditorPropertyType() const
- {
- return( DoubleType );
- }
-
- private:
- double m_dLowRange, m_dHighRange, m_dIncrement;
- bool m_bHasRange;
- };
-}}
-
-#endif // include guard
\ No newline at end of file

Deleted: sandbox/pinhole/boost/pinhole/Editor.hpp
==============================================================================
--- sandbox/pinhole/boost/pinhole/Editor.hpp 2007-12-05 18:44:39 EST (Wed, 05 Dec 2007)
+++ (empty file)
@@ -1,122 +0,0 @@
-// Pinhole Editor.hpp file
-//
-// Copyright Jared McIntyre 2007.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef BOOST_EDITOR
-#define BOOST_EDITOR
-
-#include <map>
-#include <string>
-
-using namespace std;
-//using namespace boost;
-
-namespace boost { namespace pinhole
-{
- enum EditorPropertyType
- {
- StringType,
- WStringType,
- IntegerType,
- BooleanType,
- FloatType,
- DoubleType
- };
-
- enum EditorControlType
- {
- None=0,
- EditBox=1,
- Tracker=2,
- DropDown=3,
- Radio=4,
- UpDown=5
- };
-
- class Editor
- {
- public:
- typedef std::map<std::string, std::string> property_collection;
- typedef property_collection::size_type size_type;
- typedef property_collection::iterator iterator;
- typedef property_collection::const_iterator const_iterator;
-
- /**
- * Constructor which creates a default editor that is defined as
- * no editor.
- */
- Editor() : m_UItype(EditBox) {;}
-
- /**
- * Constructor that created an editor of the specified type.
- * @param type The editor to use.
- */
- Editor(EditorControlType type)
- {
- m_UItype = type;
- }
-
- /**
- * Destructor
- */
- virtual ~Editor() {;}
-
- /**
- * Retrieves the type of the editor to use.
- */
- EditorControlType GetControlType() const
- {
- return m_UItype;
- }
-
- /**
- * Sets a property for the editor. Properties are simple key/value
- * string pairs that are used by the editor to make decision. Each
- * editor has a different set of properties that it will read.
- * @param key The property key.
- * @param value The property value.
- */
- Editor& operator()( std::string key, std::string value )
- {
- m_properties.insert( make_pair(key,value) );
-
- return *this;
- }
-
- /**
- * Overloaded operator equal.
- * @param editor The Editor class to copy.
- */
- virtual Editor& operator=( const Editor& editor )
- {
- m_UItype = editor.m_UItype;
-
- m_properties.clear();
- m_properties.insert( editor.m_properties.begin(), editor.m_properties.end() );
-
- return *this;
- }
-
-
- /**
- * Retrieves the type of the property for the editor.
- */
- virtual EditorPropertyType getEditorPropertyType() const = 0;
-
- protected:
- EditorControlType m_UItype;
- #if defined(BOOST_MSVC)
- #pragma warning(push)
- #pragma warning( disable: 4251 )
- #endif
- property_collection m_properties;
- #if defined(BOOST_MSVC)
- #pragma warning(pop)
- #endif
- };
-}}
-
-#endif // include guard
\ No newline at end of file

Deleted: sandbox/pinhole/boost/pinhole/EditorTypeFinder.hpp
==============================================================================
--- sandbox/pinhole/boost/pinhole/EditorTypeFinder.hpp 2007-12-05 18:44:39 EST (Wed, 05 Dec 2007)
+++ (empty file)
@@ -1,70 +0,0 @@
-// Pinhole EditorTypeFinder.hpp file
-//
-// Copyright Jared McIntyre 2007.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef BOOST_DETAIL_EDITORTYPEFINDER
-#define BOOST_DETAIL_EDITORTYPEFINDER
-
-#include <boost/mpl/void.hpp>
-#include "BoolEditor.hpp"
-#include "DoubleEditor.hpp"
-#include "FloatEditor.hpp"
-#include "IntegerEditor.hpp"
-#include "StringEditor.hpp"
-
-namespace boost { namespace pinhole { namespace detail
-{
-
- template<typename Value_Type>
- struct EditorTypeFinder
- {
- typedef boost::mpl::void_ type;
- };
-
- template<>
- struct EditorTypeFinder<bool>
- {
- typedef BoolEditor type;
- };
-
- template<>
- struct EditorTypeFinder<double>
- {
- typedef DoubleEditor type;
- };
-
- template<>
- struct EditorTypeFinder<float>
- {
- typedef FloatEditor type;
- };
-
- template<>
- struct EditorTypeFinder<int>
- {
- typedef IntegerEditor type;
- };
-
- template<>
- struct EditorTypeFinder<time_t>
- {
- typedef IntegerEditor type;
- };
-
- template<>
- struct EditorTypeFinder<std::string>
- {
- typedef StringEditor type;
- };
-
- template<>
- struct EditorTypeFinder<std::wstring>
- {
- typedef WStringEditor type;
- };
-}}}
-
-#endif // include guard
\ No newline at end of file

Deleted: sandbox/pinhole/boost/pinhole/FloatEditor.hpp
==============================================================================
--- sandbox/pinhole/boost/pinhole/FloatEditor.hpp 2007-12-05 18:44:39 EST (Wed, 05 Dec 2007)
+++ (empty file)
@@ -1,83 +0,0 @@
-// Pinhole FloatEditor.hpp file
-//
-// Copyright Jared McIntyre 2007.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef BOOST_FLOATEDITOR
-#define BOOST_FLOATEDITOR
-
-#include "Editor.hpp"
-
-namespace boost { namespace pinhole
-{
- class FloatEditor : public Editor
- {
- public:
- FloatEditor()
- {
- m_UItype = EditBox;
- };
-
- FloatEditor( float fLowRange,
- float fHighRange,
- float fIncrement=0.5,
- EditorControlType controlType=EditBox ) :
- m_fLowRange( fLowRange ),
- m_fHighRange( fHighRange ),
- m_fIncrement( fIncrement )
- {
- m_UItype = controlType;
- m_bHasRange = true;
- }
-
- ~FloatEditor() {;}
-
- /**
- * Retrieves the low range of the property for the editor.
- */
- float getLowRange() const
- {
- return( m_fLowRange );
- }
-
- /**
- * Retrieves the high range of the property for the editor.
- */
- float getHighRange() const
- {
- return( m_fHighRange );
- }
-
- /**
- * Retrieves the increment of the property for the editor.
- */
- float getIncrement() const
- {
- return( m_fIncrement );
- }
-
- /**
- * Retrieves the flag to use range of the property for the editor.
- */
- bool UseRange() const
- {
- return( m_bHasRange );
- }
-
- /**
- * Retrieves the type of the property for the editor.
- */
- EditorPropertyType getEditorPropertyType() const
- {
- return( FloatType );
- }
-
- private:
- float m_fLowRange, m_fHighRange, m_fIncrement;
- bool m_bHasRange;
- };
-}}
-
-#endif // include guard
\ No newline at end of file

Deleted: sandbox/pinhole/boost/pinhole/IntegerEditor.hpp
==============================================================================
--- sandbox/pinhole/boost/pinhole/IntegerEditor.hpp 2007-12-05 18:44:39 EST (Wed, 05 Dec 2007)
+++ (empty file)
@@ -1,85 +0,0 @@
-// Pinhole IntegerEditor.hpp file
-//
-// Copyright Jared McIntyre 2007.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef BOOST_INTEGEREDITOR
-#define BOOST_INTEGEREDITOR
-
-#include "Editor.hpp"
-
-namespace boost { namespace pinhole
-{
- class IntegerEditor : public Editor
- {
- public:
- IntegerEditor()
- {
- m_UItype = EditBox;
- m_bHasRange = false;
- }
-
- IntegerEditor( int iLowRange,
- int iHighRange,
- int iIncrement=0,
- EditorControlType controlType=EditBox ) :
- m_iLowRange( iLowRange ),
- m_iHighRange( iHighRange ),
- m_iIncrement( iIncrement )
- {
- m_UItype = controlType;
- m_bHasRange = true;
- }
-
- virtual ~IntegerEditor() {;}
-
-
- /**
- * Retrieves the low range of the property for the editor.
- */
- int getLowRange() const
- {
- return( m_iLowRange );
- }
-
- /**
- * Retrieves the high range of the property for the editor.
- */
- int getHighRange() const
- {
- return( m_iHighRange );
- }
-
- /**
- * Retrieves the increment of the property for the editor.
- */
- int getIncrement() const
- {
- return( m_iIncrement );
- }
-
- /**
- * Retrieves the flag to use range of the property for the editor.
- */
- bool UseRange() const
- {
- return( m_bHasRange );
- }
-
- /**
- * Retrieves the type of the property for the editor.
- */
- EditorPropertyType getEditorPropertyType() const
- {
- return( IntegerType );
- }
-
- private:
- int m_iLowRange, m_iHighRange, m_iIncrement;
- bool m_bHasRange;
- };
-}}
-
-#endif // include guard
\ No newline at end of file

Deleted: sandbox/pinhole/boost/pinhole/StringEditor.hpp
==============================================================================
--- sandbox/pinhole/boost/pinhole/StringEditor.hpp 2007-12-05 18:44:39 EST (Wed, 05 Dec 2007)
+++ (empty file)
@@ -1,54 +0,0 @@
-// Pinhole StringEditor.hpp file
-//
-// Copyright Jared McIntyre 2007.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef BOOST_STRINGEDITOR
-#define BOOST_STRINGEDITOR
-
-#include "Editor.hpp"
-
-namespace boost { namespace pinhole
-{
- class StringEditor : public Editor
- {
- public:
- StringEditor()
- {
- m_UItype = EditBox;
- }
-
- ~StringEditor() {;}
-
- /**
- * Retrieves the type of the property for the editor.
- */
- EditorPropertyType getEditorPropertyType() const
- {
- return( StringType );
- }
- };
-
- class WStringEditor : public Editor
- {
- public:
- WStringEditor()
- {
- m_UItype = EditBox;
- }
-
- ~WStringEditor() {;}
-
- /**
- * Retrieves the type of the property for the editor.
- */
- EditorPropertyType getEditorPropertyType() const
- {
- return( WStringType );
- }
- };
-}}
-
-#endif // include guard
\ No newline at end of file

Modified: sandbox/pinhole/boost/pinhole/action_info.hpp
==============================================================================
--- sandbox/pinhole/boost/pinhole/action_info.hpp (original)
+++ sandbox/pinhole/boost/pinhole/action_info.hpp 2007-12-05 18:44:39 EST (Wed, 05 Dec 2007)
@@ -10,15 +10,6 @@
 
 #if defined(BOOST_MSVC)
     #pragma warning(push)
- #pragma warning( disable: 4272 4394 )
-#endif
-#include "Editor.hpp"
-#if defined(BOOST_MSVC)
- #pragma warning(pop)
-#endif
-
-#if defined(BOOST_MSVC)
- #pragma warning(push)
     #pragma warning( disable: 4561 4793 )
 #endif
 #include <boost/type_traits.hpp>

Modified: sandbox/pinhole/boost/pinhole/main.cpp
==============================================================================
--- sandbox/pinhole/boost/pinhole/main.cpp (original)
+++ sandbox/pinhole/boost/pinhole/main.cpp 2007-12-05 18:44:39 EST (Wed, 05 Dec 2007)
@@ -190,14 +190,7 @@
     /*
     Areas that need work:
 
- 1) Generic Metadata: Properties need to have metadata associated with them so that the system can learn more about
- them. However, this metadata is system specific. I don't want to force everyone to use my metadata, when they will
- likely need something completely different. Currently the property system is built for our simulation's needs, so
- this metadata is hardcoded to the types it wants. This needs to be made generic. Perhaps use boost::any or maybe
- an additional key/value pair component would work. Either way, it would be nice to try to keep the auto-selection of
- metadata that already exists in the system.
-
- 2) Algorithms: We currently only have one path based search algorithm. This expects a single matching value and
+ 1) Algorithms: We currently only have one path based search algorithm. This expects a single matching value and
     throws otherwise. This is a useful search algorithm as is, but we need more. We need one that returns iterators
     over all the items found. We need a version of that that returns them as they exist in the system, and one that
     returns them sorted based on a given criteria. I also imagine there may be other algorithms for processing entire
@@ -205,33 +198,32 @@
     the values of all properties. Given the same tree structure, it can re-walk the tree and set the values to their
     stored values.
 
- 3) More compile time optimizations: There are a lot of powerful things you can do by creating properties at runtime.
+ 2) More compile time optimizations: There are a lot of powerful things you can do by creating properties at runtime.
     However, our experience shows that most properties are simple, and everything about them is known at compile time.
     There should be some template mechanism we could use for creating this type of property that would reduce the amount
     of time that is used at runtime to setup the property without reducing the utility of the system to create properties
     purely at runtime.
 
- 4) Property Manager Singleton: Currently the property manager is a singleton. This has been extremely helpful in
+ 3) Property Manager Singleton: Currently the property manager is a singleton. This has been extremely helpful in
     allowing us to build out the full property group tree and access it from anywhere. However, some people have
     an aversion to this pattern, and there are cases where you may want multiple managers (if you have multiple copies
     of your data layer, you probably don't want all those copies combined into the same property group tree). We haven't
     really thought much further on how to do this better and are looking for insights.
      
- 5) Safe Property Group: This is something I've been toying around with for a while. Currently it is advantagious to
+ 4) Safe Property Group: This is something I've been toying around with for a while. Currently it is advantagious to
     get a property group and hold on to it. However, since property groups are retrieved largely as pointers, this can
     be dangerious. I can't use shared_ptr since the object that it is pointing to may have been created on the stack,
     and it won't have control over deletion (among other issues). I have a prototype class that wraps the property group
     and listens to the property manager to see when it is destroyed, but I'm not sure I like that idea (and it is part of
     our C++/CLI wrapper, so it isn't something I can share).
 
- 6) Documentation: We currently have doxygen documented objects for this code. If we are going to submit to boost, we
+ 5) Documentation: We currently have doxygen documented objects for this code. If we are going to submit to boost, we
     would need quickbook docs on top of that that show how to use everything.
     
     Discussion Points:
      
- 1) Header Files: I'm distributing this as header only. I did this since it simplified initial distribution (I didn't have
- to get bjam working right away). In house, we build a library. There a lot of things that can be hidden from the user,
- including defining the static instances of the singeltons, if we use a library.
+ 1) Header Only: This is currently built as a library since the property_manager is a singleton, and the basic functionality
+ relies on that. If this fact changes, I'd like to look at making this header only.
      
     2) Right now we have several different begin/end function pairs in property_group for accessing the different data in
     the system. Is that really the best way to do it? Whould we be passing back const references to the collections instead?

Modified: sandbox/pinhole/boost/pinhole/property_group.hpp
==============================================================================
--- sandbox/pinhole/boost/pinhole/property_group.hpp (original)
+++ sandbox/pinhole/boost/pinhole/property_group.hpp 2007-12-05 18:44:39 EST (Wed, 05 Dec 2007)
@@ -9,7 +9,6 @@
 #define BOOST_PROPERTY_GROUP
 
 #include "map_key_value_iterators.hpp"
-#include "EditorTypeFinder.hpp"
 #include "property_info.hpp"
 #include "action_info.hpp"
 #include "property_manager.hpp"
@@ -87,10 +86,8 @@
     #define BOOST_GETTER_VAR(c) boost::pinhole::property_system_var_getter_builder(c)
 
     struct no_setter_struct {};
- struct no_getter_struct {};
     
     #define BOOST_SETTER_NONE boost::pinhole::no_setter_struct()
- #define BOOST_GETTER_NONE boost::pinhole::no_getter_struct()
 
     class property_group;
 
@@ -365,7 +362,7 @@
             /**
              * Sets a property's value.
              * @param property The name of the property.
- * @param value A String representation of the value to set on the property.
+ * @param value A string representation of the value to set on the property.
              * @throw boost::bad_function_call There isn't a set_as_string function associated with this property.
              * @throw std::out_of_range The property requested does not exist.
              * @throw std::invalid_argument The value string could not be converted to the
@@ -383,7 +380,34 @@
                 }
                 else
                 {
- stringstream err;
+ std::stringstream err;
+ err << "The requested property \"" << property << "\" does not exist.";
+ throw std::out_of_range(err.str().c_str());
+ }
+ }
+
+ /**
+ * Sets a property's value.
+ * @param property The name of the property.
+ * @param value A wide-character string representation of the value to set on the property.
+ * @throw boost::bad_function_call There isn't a set_as_string function associated with this property.
+ * @throw std::out_of_range The property requested does not exist.
+ * @throw std::invalid_argument The value string could not be converted to the
+ * type expected by the internal setter function.
+ */
+ void set_as_wstring(const std::string &property, const std::wstring &value)
+ {
+ property_collection::iterator itemItr = m_properties.find(property);
+
+ if( m_properties.end() != itemItr )
+ {
+ // throws boost::bad_function_call if there isn't a set_as_string
+ // function associated with this property.
+ (*itemItr).second->set_as_wstring(value);
+ }
+ else
+ {
+ std::stringstream err;
                     err << "The requested property \"" << property << "\" does not exist.";
                     throw std::out_of_range(err.str().c_str());
                 }
@@ -392,7 +416,7 @@
             /**
              * Gets a property's value.
              * @param property The name of the property.
- * @return A String representation of the value of the property.
+ * @return A string representation of the value of the property.
              * @throw boost::bad_function_call There isn't a get_as_string function associated with this property.
              * @throw std::out_of_range The property requested does not exist.
              */
@@ -407,7 +431,30 @@
                     return (*itemItr).second->get_as_string();
                 }
                 
- stringstream err;
+ std::stringstream err;
+ err << "The requested property \"" << property << "\" does not exist.";
+ throw std::out_of_range(err.str().c_str());
+ }
+
+ /**
+ * Gets a property's value.
+ * @param property The name of the property.
+ * @return A wide-character string representation of the value of the property.
+ * @throw boost::bad_function_call There isn't a get_as_string function associated with this property.
+ * @throw std::out_of_range The property requested does not exist.
+ */
+ std::wstring get_as_wstring(const std::string &property) const
+ {
+ property_collection::const_iterator itemItr = m_properties.find(property);
+
+ if( m_properties.end() != itemItr )
+ {
+ // throws boost::bad_function_call if there isn't a get_as_string
+ // function associated with this property.
+ return (*itemItr).second->get_as_wstring();
+ }
+
+ std::stringstream err;
                 err << "The requested property \"" << property << "\" does not exist.";
                 throw std::out_of_range(err.str().c_str());
             }
@@ -419,26 +466,17 @@
             * @throw no_metadata_defined_error There isn't a property editor associated with this property.
             * @throw std::out_of_range The property requested does not exist.
             */
- const Editor* get_metadata(const std::string &property) const
+ const boost::any& get_metadata(const std::string &property) const
             {
                 property_collection::const_iterator itemItr = m_properties.find(property);
                 
                 if( itemItr != m_properties.end() )
                 {
- // throws boost::bad_function_call if there isn't a get
- // function associated with this property.
- if ( (*itemItr).second->m_editor == NULL )
- {
- throw( no_metadata_defined_error() );
- }
- else
- {
- return( (*itemItr).second->m_editor );
- }
+ return( (*itemItr).second->m_metadata );
                 }
                 else
                 {
- stringstream err;
+ std::stringstream err;
                     err << "The requested property \"" << property << "\" does not exist.";
                     throw std::out_of_range(err.str().c_str());
                 }
@@ -460,7 +498,7 @@
                 }
                 else
                 {
- stringstream err;
+ std::stringstream err;
                     err << "The requested property \"" << property << "\" does not exist.";
                     throw std::out_of_range(err.str().c_str());
                 }
@@ -483,7 +521,7 @@
                 }
                 else
                 {
- stringstream err;
+ std::stringstream err;
                     err << "The requested property \"" << property << "\" does not exist.";
                     throw std::out_of_range(err.str().c_str());
                 }
@@ -553,7 +591,7 @@
                 }
                 else
                 {
- stringstream err;
+ std::stringstream err;
                     err << "The requested action \"" << action << "\" does not exist.";
                     throw std::out_of_range(err.str().c_str());
                 }
@@ -574,7 +612,7 @@
                            Setter setter,
                            Getter getter)
         {
- internal_add_property< typename Getter::result_type >( name, description, setter, getter);
+ internal_add_property< typename Getter::result_type >( name, description, setter, getter, boost::any());
         }
         
         /**
@@ -590,23 +628,7 @@
                            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,
- Setter setter,
- no_getter_struct getter)
- {
- internal_add_property< typename Setter::argument_type >( name, description, setter, NULL);
+ internal_add_property< typename Getter::result_type >( name, description, NULL, getter, boost::any());
         }
     
         /**
@@ -619,13 +641,13 @@
          * if there isn't one.
          */
         template< typename Setter, typename Getter>
- void add_property( string name,
- string description,
+ void add_property( std::string name,
+ std::string description,
                            Setter setter,
                            Getter getter,
- Editor *pEditor )
+ boost::any metadata )
         {
- internal_add_property< typename Getter::result_type >( name, description, setter, getter, pEditor);
+ internal_add_property< typename Getter::result_type >( name, description, setter, getter, metadata);
         }
 
         /**
@@ -638,13 +660,13 @@
          * if there isn't one.
          */
         template< typename Getter>
- void add_property( string name,
- string description,
+ void add_property( std::string name,
+ std::string description,
                            no_setter_struct,
                            Getter getter,
- Editor *pEditor )
+ boost::any metadata )
         {
- internal_add_property< typename Getter::result_type >( name, description, NULL, getter, pEditor);
+ internal_add_property< typename Getter::result_type >( name, description, NULL, getter, metadata);
         }
 
         /**
@@ -697,29 +719,20 @@
 
     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 )
+ boost::any &metadata )
         {
+ property_collection::iterator previousInstance = m_properties.find(name);
+ if( m_properties.end() != previousInstance )
+ {
+ delete (*previousInstance).second;
+ }
+
             // 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>();
 
@@ -727,13 +740,13 @@
             prop->m_description = description;
             if( NULL != setter )
             {
- prop->setter = setter;
+ prop->setter = setter;
             }
             if( NULL != getter )
             {
- prop->getter = getter;
+ prop->getter = getter;
             }
- prop->m_editor = pEditor;
+ prop->m_metadata = metadata;
 
             m_properties.insert( std::make_pair(name, prop) );
         }

Deleted: sandbox/pinhole/boost/pinhole/property_group_wrapper.hpp
==============================================================================
--- sandbox/pinhole/boost/pinhole/property_group_wrapper.hpp 2007-12-05 18:44:39 EST (Wed, 05 Dec 2007)
+++ (empty file)
@@ -1,100 +0,0 @@
-// Pinhole property_group_wrapper.hpp file
-//
-// Copyright Jared McIntyre 2007.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef BOOST_PROPERTY_GROUP_WRAPPER
-#define BOOST_PROPERTY_GROUP_WRAPPER
-
-#include "property_group.hpp"
-
-namespace boost { namespace pinhole
-{
- /**
- * The property_group_wrapper allows you to create property groups without inheriting directly
- * from property_group. This allows you to do things like create groups of properties for
- * display in the UI that don't have a matching logical object in the system.
- */
- class property_group_wrapper : public property_group
- {
- public:
- /**
- * Constructor.
- * @param name The name of this property group (like an xml node name)
- * @param parent The parent of the this object.
- */
- property_group_wrapper(std::string name, property_group *parent)
- : property_group(name, parent){;}
-
- ~property_group_wrapper(void){;}
-
- /**
- * Adds a property to the property list.
- * @param 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,
- Setter setter,
- Getter getter )
- {
- property_group::add_property( name, description, setter, getter );
- }
-
- /**
- * Adds a property to the property list.
- * @param 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( std::string name,
- std::string description,
- Setter setter,
- Getter getter,
- Editor *pEditor )
- {
-
- property_group::add_property( name, description, setter, getter, pEditor );
- }
-
- /**
- * Adds an action to the action list.
- * @param The name of the action.
- * @param description A brief description of the action for the user interface.
- * @param action The function used to trigger the action.
- */
- inline void add_action( std::string name,
- std::string description,
- boost::function<void ()> action )
- {
-
- property_group::add_action( name, description, action );
- }
-
- /**
- * Gets an xml string representation of this property group
- * @param string The name of the new category.
- * @return The xml string representation of this property group.
- */
- inline void add_category( const std::string &category_name )
- {
- property_group::add_category( category_name );
- }
-
- private:
- property_group_wrapper() : property_group("", NULL) {;}
- property_group_wrapper(const property_group& object) : property_group(object) {;}
- property_group_wrapper(const property_group_wrapper& object) : property_group(object) {;}
- };
-}}
-
-#endif // include guard
\ No newline at end of file

Modified: sandbox/pinhole/boost/pinhole/property_info.hpp
==============================================================================
--- sandbox/pinhole/boost/pinhole/property_info.hpp (original)
+++ sandbox/pinhole/boost/pinhole/property_info.hpp 2007-12-05 18:44:39 EST (Wed, 05 Dec 2007)
@@ -10,21 +10,14 @@
 
 #if defined(BOOST_MSVC)
     #pragma warning(push)
- #pragma warning( disable: 4272 4394 )
-#endif
-#include "Editor.hpp"
-#if defined(BOOST_MSVC)
- #pragma warning(pop)
-#endif
-
-#if defined(BOOST_MSVC)
- #pragma warning(push)
     #pragma warning( disable: 4561 4793 )
 #endif
 #include <boost/type_traits.hpp>
 #include <boost/function.hpp>
 #include <boost/lexical_cast.hpp>
 #include <boost/algorithm/string/predicate.hpp>
+#include <boost/format.hpp>
+#include <boost/any.hpp>
 #if defined(BOOST_MSVC)
     #pragma warning(pop)
 #endif
@@ -33,6 +26,8 @@
 {
     #define BOOL_TRUE "True"
     #define BOOL_FALSE "False"
+ #define W_BOOL_TRUE L"True"
+ #define W_BOOL_FALSE L"False"
 
     ///////////////////////////////////////////////////
     // set_as_string Override Functors
@@ -43,11 +38,11 @@
      * to convert the passed in set string to any type that
      * has proper stream operators.
      */
- template<typename Value_Type>
+ template<typename String_Type, typename Value_Type>
     struct internal_string_set
     {
         template<typename Set_Type>
- inline void operator()( Set_Type setter, std::string value )
+ inline void operator()( Set_Type setter, String_Type value )
         {
             try
             {
@@ -55,9 +50,7 @@
             }
             catch(boost::bad_lexical_cast &)
             {
- std::stringstream err;
- err << "The value '" << value << "' is not valid for this property.";
- throw std::invalid_argument(err.str().c_str());
+ throw std::invalid_argument( "An invalid property value was used to set." );
             }
         }
     };
@@ -68,7 +61,7 @@
      * conversion.
      */
     template<>
- struct internal_string_set<std::string>
+ struct internal_string_set<std::string, std::string>
     {
         template<typename Set_Type>
         inline void operator()( Set_Type setter, std::string value )
@@ -77,13 +70,53 @@
         }
     };
 
+ /**
+ * Setter for handling string types. Since a string was passed in, and
+ * the type in the setter function is a string, we don't need to do any
+ * conversion.
+ */
+ template<>
+ struct internal_string_set<std::wstring, std::wstring>
+ {
+ template<typename Set_Type>
+ inline void operator()( Set_Type setter, std::wstring value )
+ {
+ setter( value );
+ }
+ };
+
+ /**
+ * Setter for incompatible string types.
+ */
+ template<>
+ struct internal_string_set<std::wstring, std::string>
+ {
+ template<typename Set_Type>
+ inline void operator()( Set_Type setter, std::wstring value )
+ {
+ throw std::invalid_argument( "A wstring cannot be used to set a string." );
+ }
+ };
+
+ /**
+ * Setter for incompatible string types.
+ */
+ template<>
+ struct internal_string_set<std::string, std::wstring>
+ {
+ template<typename Set_Type>
+ inline void operator()( Set_Type setter, std::string value )
+ {
+ throw std::invalid_argument( "A string cannot be used to set a wstring." );
+ }
+ };
 
     /**
     * Setter for handling bool types. Since a bool was passed in,
     * we need to convert
     */
     template<>
- struct internal_string_set<bool>
+ struct internal_string_set<std::string, bool>
     {
         template<typename Set_Type>
         inline void operator()( Set_Type setter, std::string value )
@@ -92,6 +125,21 @@
         }
     };
 
+
+ /**
+ * Setter for handling bool types. Since a bool was passed in,
+ * we need to convert
+ */
+ template<>
+ struct internal_string_set<std::wstring, bool>
+ {
+ template<typename Set_Type>
+ inline void operator()( Set_Type setter, std::wstring value )
+ {
+ setter( boost::iequals(value, W_BOOL_TRUE) || value == L"1" );
+ }
+ };
+
     ///////////////////////////////////////////////////
     // get_as_string Override Functors
     ///////////////////////////////////////////////////
@@ -104,13 +152,13 @@
      * should work.
      */
 
- template<typename Value_Type>
+ template<class String_Type, typename Value_Type>
     struct internal_string_get
     {
         template<typename Get_Type>
- inline std::string operator()( Get_Type getter ) const
+ inline String_Type operator()( Get_Type getter ) const
         {
- return boost::lexical_cast<string>( getter() );
+ return boost::lexical_cast<String_Type>( getter() );
         }
     };
 
@@ -120,7 +168,7 @@
      * conversion.
      */
     template<>
- struct internal_string_get<std::string>
+ struct internal_string_get<std::string, std::string>
     {
         template<typename Get_Type>
         inline std::string operator()( Get_Type getter ) const
@@ -130,16 +178,71 @@
     };
 
     /**
+ * Getter for handling string types. Since a string returned,
+ * and getter returns a string type, we don't need to do any
+ * conversion.
+ */
+ template<>
+ struct internal_string_get<std::wstring, std::wstring>
+ {
+ template<typename Get_Type>
+ inline std::wstring operator()( Get_Type getter ) const
+ {
+ return getter();
+ }
+ };
+
+ /**
+ * Getter for handling incompatible string types.
+ */
+ template<>
+ struct internal_string_get<std::string, std::wstring>
+ {
+ template<typename Get_Type>
+ inline std::string operator()( Get_Type getter ) const
+ {
+ throw std::invalid_argument( "A wstring property cannot be returned as a string." );
+ }
+ };
+
+ /**
+ * Getter for handling incompatible string types.
+ */
+ template<>
+ struct internal_string_get<std::wstring, std::string>
+ {
+ template<typename Get_Type>
+ inline std::wstring operator()( Get_Type getter ) const
+ {
+ throw std::invalid_argument( "A wstring property cannot be returned as a string." );
+ }
+ };
+
+ /**
     * Getter for handling bool types. Since a string is returned,
     * we need to convert the bool to a string.
     */
     template<>
- struct internal_string_get<bool>
+ struct internal_string_get<std::string, bool>
     {
         template<typename Get_Type>
         inline std::string operator()( Get_Type getter ) const
         {
- return( getter() ? "True" : "False" );
+ return( getter() ? BOOL_TRUE : BOOL_FALSE );
+ }
+ };
+
+ /**
+ * Getter for handling bool types. Since a string is returned,
+ * we need to convert the bool to a string.
+ */
+ template<>
+ struct internal_string_get<std::wstring, bool>
+ {
+ template<typename Get_Type>
+ inline std::wstring operator()( Get_Type getter ) const
+ {
+ return( getter() ? W_BOOL_TRUE : W_BOOL_FALSE );
         }
     };
 
@@ -147,23 +250,18 @@
     {
     public:
         property_info_base(const type_info &type) :
- m_editor( NULL ),
           m_type(type)
         {;}
 
- virtual ~property_info_base()
- {
- if ( m_editor != NULL )
- delete( m_editor );
- }
-
         std::string m_name;
         std::string m_description;
- Editor *m_editor;
+ boost::any m_metadata;
         const type_info &m_type;
 
         virtual void set_as_string(std::string value) = 0;
+ virtual void set_as_wstring(std::wstring value) = 0;
         virtual std::string get_as_string() const = 0;
+ virtual std::wstring get_as_wstring() const = 0;
         virtual bool is_read_only() const = 0;
     };
 
@@ -181,8 +279,8 @@
         // types due to the ambiguity of their use.
         BOOST_STATIC_ASSERT(false == boost::is_pointer<Value_Type>::value);
 
- setter_type setter;
- getter_type getter;
+ setter_type setter;
+ getter_type getter;
 
         property_info() : property_info_base(typeid(T)) {;}
 
@@ -200,7 +298,24 @@
             // then the type you are using for the property doesn't have a proper operator<< for it
             //
             // throws boost::bad_function_call if there isn't a get_as_string function associated with this property.
- return internal_string_get<Value_Type>()(getter);
+ return internal_string_get<std::string, Value_Type>()(getter);
+ }
+
+ /**
+ * Calls the appropriate getter function for this parameter and converts
+ * the value to a wide-character string for return.
+ *
+ * @return A String representation of the value of the property.
+ * @throw boost::bad_function_call There isn't a get_as_string function associated with this property.
+ */
+ virtual std::wstring get_as_wstring() const
+ {
+ // If you get an error here, and it complains about:
+ // error C2679: binary '<<' : no operator found which takes a right-hand operand of type
+ // then the type you are using for the property doesn't have a proper operator<< for it
+ //
+ // throws boost::bad_function_call if there isn't a get_as_string function associated with this property.
+ return internal_string_get<std::wstring, Value_Type>()(getter);
         }
 
         /**
@@ -228,7 +343,35 @@
             // see the function documentation for more information about this.
             //
             // throws boost::bad_function_call if there isn't a set_as_string function associated with this property.
- internal_string_set<Value_Type>()(setter, value);
+ internal_string_set<std::string, Value_Type>()(setter, value);
+ }
+
+ /**
+ * Calls the appropriate setter function for this parameter and converts
+ * the passed in wide-character string to whatever type the setter is expect. For example,
+ * if the properties setter is expecting an int, the string will be
+ * converted to an int before being passed to the function.
+ * <br><br>
+ * We call an internal setter in a struct so that we can override
+ * what the set does based on the type of Value_Type. For example,
+ * we wanted to write a special handler for the string type for
+ * performance, so we overrode the string handler in "struct Internal<string>"
+ * to just pass the string along instead of convert it. The beauty of doing it
+ * this way is that there is no runtime cost. All functions are inlined,
+ * and the additional function calls and type processing are optimized out
+ * at compile time.
+ *
+ * @param value A String representation of the value to set on the property.
+ * @throw boost::bad_function_call There isn't a set_as_string function associated with this property.
+ * @throw std::invalid_argument The value string could not be converted to the
+ * type expected by the internal setter function.
+ */
+ virtual void set_as_wstring(std::wstring value)
+ {
+ // see the function documentation for more information about this.
+ //
+ // throws boost::bad_function_call if there isn't a set_as_string function associated with this property.
+ internal_string_set<std::wstring, Value_Type>()(setter, value);
         }
 
         /**

Modified: sandbox/pinhole/libs/pinhole/test/Jamfile.v2
==============================================================================
--- sandbox/pinhole/libs/pinhole/test/Jamfile.v2 (original)
+++ sandbox/pinhole/libs/pinhole/test/Jamfile.v2 2007-12-05 18:44:39 EST (Wed, 05 Dec 2007)
@@ -22,7 +22,6 @@
   test-suite pinhole
     :
   [ run test_property_groups.cpp ]
- #[ run test_property_group_wrapper.cpp ]
   
   [ run test_bool_properties.cpp ]
   [ run test_double_properties.cpp ]

Deleted: sandbox/pinhole/libs/pinhole/test/TestClassesAndConstants.hpp
==============================================================================
--- sandbox/pinhole/libs/pinhole/test/TestClassesAndConstants.hpp 2007-12-05 18:44:39 EST (Wed, 05 Dec 2007)
+++ (empty file)
@@ -1,542 +0,0 @@
-// Boost.Pinhole library
-
-// Copyright Jared McIntyre 2007. Use, modification and
-// distribution is subject to the Boost Software License, Version
-// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-// For more information, see http://www.boost.org
-
-#include <boost/pinhole.hpp>
-
-using namespace boost::pinhole;
-
-#define PROPERTY_GROUP_NAME ("TestPropertyGroup")
-#define PROPERTY_GROUP_CATEGORY1 ("MyPropertyGroupCategory1")
-#define PROPERTY_GROUP_CATEGORY2 ("MyPropertyGroupCategory2")
-#define PROPERTY_GROUP_CATEGORY3 ("MyPropertyGroupCategory3")
-#define PROPERTY_GROUP_CHILD_NAME ("TestPropertyChildGroup")
-
-#define PROPERTY_STRING_1 ("PropertyString1")
-#define PROPERTY_STRING_1_VALUE ("PropertyString1_Value")
-
-#define PROPERTY_FLOAT_1 ("PropertyFloat1")
-#define PROPERTY_FLOAT_1_VAR ("PropertyFloat1Var")
-#define PROPERTY_FLOAT_1_VALUE ( 3.14161f )
-#define PROPERTY_FLOAT_1_STRING_VALUE ( "3.14161" )
-
-#define PROPERTY_FLOAT_2 ("PropertyFloat2")
-#define PROPERTY_FLOAT_2_VALUE ( 345.123f )
-#define PROPERTY_FLOAT_2_STRING_VALUE ( "345.123" )
-
-#define PROPERTY_DOUBLE ("PropertyDouble")
-#define PROPERTY_DOUBLE_VAR ("PropertyDoubleVar")
-#define PROPERTY_DOUBLE_VALUE ( 54321.1234596432 )
-#define PROPERTY_DOUBLE_STRING_VALUE ( "54321.1234596432" )
-
-#define PROPERTY_DOUBLE_2 ("PropertyDouble2")
-#define PROPERTY_DOUBLE_2_VALUE ( 54321.1234596432 )
-#define PROPERTY_DOUBLE_2_STRING_VALUE ( "54321.1234596432" )
-
-#define PROPERTY_INT_1 ("PropertyInt1")
-#define PROPERTY_INT_1_VAR ("PropertyInt1Var")
-#define PROPERTY_INT_1_VALUE (54321)
-#define PROPERTY_INT_1_STRING_VALUE ("54321")
-#define PROPERTY_INT_2 ("PropertyInt2")
-#define PROPERTY_INT_2_VALUE (12345)
-
-#define PROPERTY_STRING_2 ("PropertyString2")
-#define PROPERTY_STRING_2_VAR ("PropertyString2Var")
-#define PROPERTY_STRING_2_VALUE ("PropertyString2_Value")
-
-#define PROPERTY_BOOL ("PropertyBool")
-#define PROPERTY_BOOL_VAR ("PropertyBoolVar")
-#define PROPERTY_BOOL_VALUE ("True")
-
-#define PROPERTY_NAME ("Name")
-
-#define ACTION_1 ("BOOST_ACTION 1")
-#define ACTION_2 ("BOOST_ACTION 2")
-
-const static string PropertyGroupXML(
-"<TestPropertyGroup>\
-<PropertyBool>True</PropertyBool>\
-<PropertyFloat1>3.14161</PropertyFloat1>\
-<PropertyInt1>54321</PropertyInt1>\
-<PropertyString1>PropertyString1_Value</PropertyString1>\
-<PropertyString2>PropertyString2_Value</PropertyString2>\
-<TestPropertyChildGroup>\
-<PropertyFloat1>3.14161</PropertyFloat1>\
-<PropertyInt1>54321</PropertyInt1>\
-<PropertyString2>PropertyString2_Value</PropertyString2>\
-</TestPropertyChildGroup>\
-<TestPropertyChildGroup>\
-<PropertyFloat1>3.14161</PropertyFloat1>\
-<PropertyInt1>54321</PropertyInt1>\
-<PropertyString2>PropertyString2_Value</PropertyString2>\
-</TestPropertyChildGroup>\
-</TestPropertyGroup>"
-);
-
-// helper function to convert from types to strings
-template <class T>
-bool from_string(T& t,
- const std::string& s,
- std::ios_base& (*f)(std::ios_base&))
-{
- std::istringstream iss(s);
- return !(iss >> f >> t).fail();
-}
-
-class TestPropertyChildGroup : public property_group
-{
-public:
- TestPropertyChildGroup( property_group *pParentGroup) : property_group( PROPERTY_GROUP_CHILD_NAME, pParentGroup )
- {
- 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 );}
- void SetFloat( float fValue ){m_fFloat1 = fValue;}
- int GetInt() const{return( m_iInt1 );}
- void SetInt( int iValue ){m_iInt1 = iValue;}
- string GetPropertyString2(){return( m_strString2 );}
- void SetPropertyString2( string strValue ){m_strString2 = strValue;}
-
- float m_fFloat1;
- int m_iInt1;
- string m_strString2;
-};
-
-class TestPropertyGroup : public property_group
-{
-public:
-#if defined(BOOST_MSVC)
- #pragma warning(push)
- #pragma warning( disable: 4355 )
-#endif
- TestPropertyGroup() : property_group( PROPERTY_GROUP_NAME, NULL ), m_child1( this ), m_child2( this )
- {
- m_bVarBool = false;
-
- 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(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)
-#endif
-
- TestPropertyChildGroup m_child1;
- TestPropertyChildGroup m_child2;
-
- string GetPropertyString1(){return PROPERTY_STRING_1_VALUE;}
- float GetFloat() const{return( m_fFloat1 );}
- void SetFloat( float fValue ){m_fFloat1 = fValue;}
- int GetInt() const{return( m_iInt1 );}
- void SetInt( int iValue ){m_iInt1 = iValue;}
- string GetPropertyString2(){return( m_strString2 );}
- void SetPropertyString2( string strValue ){m_strString2 = strValue;}
- void SetBool( bool b ){ m_bBool = b; }
- bool GetBool(){ return( m_bBool ); }
-
-private:
- float m_fFloat1;
- int m_iInt1;
- string m_strString2;
- bool m_bBool;
-
- float m_fVarFloat1;
- int m_iVarInt1;
- string m_strVarString2;
- bool m_bVarBool;
-};
-
-class TestPropertyGroup_1 : public property_group
-{
-public:
- TestPropertyGroup_1() : property_group( PROPERTY_GROUP_NAME, NULL )
- {
- 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:
- float GetFloat() const{return( m_fFloat1 );}
- void SetFloat( float fValue ){m_fFloat1 = fValue;}
- int GetInt() const{return( m_iInt1 );}
- void SetInt( int iValue ){m_iInt1 = iValue;}
- string GetPropertyString2(){return( m_strString2 );}
- void SetPropertyString2( string strValue ){m_strString2 = strValue;}
-
- float m_fFloat1;
- int m_iInt1;
- string m_strString2;
-};
-
-const static string PropertyGroupXML_1(
-"<TestPropertyGroup PropertyFloat1='3.14161' PropertyString2='PropertyString2_Value'>\
-<PropertyInt1>54321</PropertyInt1>\
-</TestPropertyGroup>" );
-
-class TestPropertyGroup_2 : public property_group
-{
-public:
- TestPropertyGroup_2() : property_group( PROPERTY_GROUP_NAME, NULL )
- {
- 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:
- float GetFloat() const{return( m_fFloat1 );}
- void SetFloat( float fValue ){m_fFloat1 = fValue;}
- int GetInt() const{return( m_iInt1 );}
- void SetInt( int iValue ){m_iInt1 = iValue;}
- string GetPropertyString2(){return( m_strString2 );}
- void SetPropertyString2( string strValue ){m_strString2 = strValue;}
-
- float m_fFloat1;
- int m_iInt1;
- string m_strString2;
-};
-
-const static string PropertyGroupXML_2(
-"<TestPropertyGroup PropertyFloat1='3.14161' PropertyInt1='54321' PropertyString2='PropertyString2_Value'></TestPropertyGroup>" );
-
-class TestPropertyChildGroup_1 : public property_group
-{
-public:
- TestPropertyChildGroup_1( property_group *pParentGroup) : property_group( PROPERTY_GROUP_CHILD_NAME, pParentGroup )
- {
- 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:
- float GetFloat() const{return( m_fFloat1 );}
- void SetFloat( float fValue ){m_fFloat1 = fValue;}
- int GetInt() const{return( m_iInt1 );}
- void SetInt( int iValue ){m_iInt1 = iValue;}
- string GetPropertyString2(){return( m_strString2 );}
- void SetPropertyString2( string strValue ){m_strString2 = strValue;}
-
- float m_fFloat1;
- int m_iInt1;
- string m_strString2;
-};
-
-class TestPropertyGroup_3 : public property_group
-{
-public:
-#if defined(BOOST_MSVC)
- #pragma warning(push)
- #pragma warning( disable: 4355 )
-#endif
- TestPropertyGroup_3() : property_group( PROPERTY_GROUP_NAME, NULL ), m_child1( this ), m_child2( this )
- {
- 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)
-#endif
-
- TestPropertyChildGroup_1 m_child1;
- TestPropertyChildGroup_1 m_child2;
-
-private:
- float GetFloat() const{return( m_fFloat1 );}
- void SetFloat( float fValue ){m_fFloat1 = fValue;}
- int GetInt() const{return( m_iInt1 );}
- void SetInt( int iValue ){m_iInt1 = iValue;}
- string GetPropertyString2(){return( m_strString2 );}
- void SetPropertyString2( string strValue ){m_strString2 = strValue;}
- void SetBool( bool b ){ m_bBool = b; }
- bool GetBool(){ return( m_bBool ); }
-
- float m_fFloat1;
- int m_iInt1;
- string m_strString2;
- bool m_bBool;
-};
-
-const static string PropertyGroupXML_3(
-"<TestPropertyGroup PropertyFloat1='3.14161'>\
-<PropertyBool>True</PropertyBool>\
-<PropertyInt1>54321</PropertyInt1>\
-<PropertyString2>PropertyString2_Value</PropertyString2>\
-<TestPropertyChildGroup PropertyInt1='54321'>\
-<PropertyFloat1>3.14161</PropertyFloat1>\
-<PropertyString2>PropertyString2_Value</PropertyString2>\
-</TestPropertyChildGroup>\
-<TestPropertyChildGroup PropertyInt1='54321'>\
-<PropertyFloat1>3.14161</PropertyFloat1>\
-<PropertyString2>PropertyString2_Value</PropertyString2>\
-</TestPropertyChildGroup>\
-</TestPropertyGroup>" );
-
-const int INT_LOW = 3;
-const int INT_HIGH = 25;
-const int INT_INCREMENT = 2;
-const float FLOAT_LOW = -10.6f;
-const float FLOAT_HIGH = 25.7f;
-const float FLOAT_INCREMENT = 1.5f;
-const double DOUBLE_LOW = -3.7;
-const double DOUBLE_HIGH = 72.6;
-const double DOUBLE_INCREMENT = 0.5;
-class TestPropertyGroup_4 : public property_group
-{
-public:
-#if defined(BOOST_MSVC)
- #pragma warning(push)
- #pragma warning( disable: 4355 )
-#endif
- TestPropertyGroup_4() : property_group( PROPERTY_GROUP_NAME, NULL ), m_child1( this ), m_child2( this )
- {
- 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)
-#endif
-
- TestPropertyChildGroup_1 m_child1;
- TestPropertyChildGroup_1 m_child2;
- float GetFloat() const{return( m_fFloat1 );}
- void SetFloat( float fValue ){m_fFloat1 = fValue;}
- float GetFloat2() const{return( m_fFloat2 );}
- void SetFloat2( float fValue ){m_fFloat2 = fValue;}
- int GetInt() const{return( m_iInt1 );}
- void SetInt( int iValue ){m_iInt1 = iValue;}
- string GetPropertyString2(){return( m_strString2 );}
- void SetPropertyString2( string strValue ){m_strString2 = strValue;}
- void SetBool( bool b ){ m_bBool = b; }
- bool GetBool(){ return( m_bBool ); }
-
-private:
- float m_fFloat1;
- float m_fFloat2;
- int m_iInt1;
- string m_strString2;
- bool m_bBool;
-};
-
-const static string PropertyGroupXML_5(
-"<TestPropertyGroup>\
-<PropertyBool>True</PropertyBool>\
-<PropertyInt1>54321</PropertyInt1>\
-</TestPropertyGroup>" );
-
-class TestPropertyGroup_5 : public property_group
-{
-public:
- TestPropertyGroup_5() : property_group( PROPERTY_GROUP_NAME, NULL )
- {
- 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(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 )
- {
- property_group::add_category( category_name );
- }
-
-
- template<typename Setter, typename Getter>
- void add_property( std::string name,
- std::string description,
- Setter setter,
- Getter getter )
- {
- property_group::add_property( name, description, setter, getter );
- }
-
- template<typename Setter, typename Getter>
- void add_property( std::string name,
- std::string description,
- Setter setter,
- Getter getter,
- Editor *pEditor )
- {
- property_group::add_property( name, description, setter, getter, pEditor );
- }
-
- void clear_properties()
- {
- m_properties.clear();
- }
-
- float GetFloat() const{return( m_fFloat1 );}
- void SetFloat( float fValue ){m_fFloat1 = fValue;}
- double GetDouble() const{return( m_dDouble );}
- void SetDouble( double dValue ){m_dDouble = dValue;}
- double GetDouble2() const{return( m_dDouble2 );}
- void SetDouble2( double dValue ){m_dDouble2 = dValue;}
- int GetInt() const{return( m_iInt1 );}
- void SetInt( int iValue ){m_iInt1 = iValue;}
- string GetPropertyString2(){return( m_strString2 );}
- void SetPropertyString2( string strValue ){m_strString2 = strValue;}
- void SetBool( bool b ){ m_bBool = b; }
- bool GetBool(){ return( m_bBool ); }
-
-private:
- float m_fFloat1;
- double m_dDouble;
- double m_dDouble2;
- int m_iInt1;
- string m_strString2;
- bool m_bBool;
-
- double m_dVarDouble;
-};
-
-class TestAutoGeneratedDesigners : public property_group
-{
-public:
-#if defined(BOOST_MSVC)
- #pragma warning(push)
- #pragma warning( disable: 4355 )
-#endif
- TestAutoGeneratedDesigners() : property_group( PROPERTY_GROUP_NAME, NULL )
- {
- 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)
- #pragma warning(pop)
-#endif
-
-private:
- string GetPropertyString1(){return PROPERTY_STRING_1_VALUE;}
- float GetFloat() const{return( m_fFloat1 );}
- void SetFloat( float fValue ){m_fFloat1 = fValue;}
- int GetInt() const{return( m_iInt1 );}
- void SetInt( int iValue ){m_iInt1 = iValue;}
- string GetPropertyString2(){return( m_strString2 );}
- void SetPropertyString2( string strValue ){m_strString2 = strValue;}
- void SetBool( bool b ){ m_bBool = b; }
- bool GetBool(){ return( m_bBool ); }
- double GetDouble() const{return( m_dDouble );}
- void SetDouble( double dValue ){m_dDouble = dValue;}
-
- float m_fFloat1;
- int m_iInt1;
- string m_strString2;
- bool m_bBool;
- double m_dDouble;
-};
-
-class TestUpDownGroup : public property_group
-{
-public:
- TestUpDownGroup() : property_group( PROPERTY_GROUP_NAME, NULL )
- {
- add_property(PROPERTY_FLOAT_1, "PropertyFloat1 description", BOOST_SETTER(&TestUpDownGroup::SetFloat), BOOST_GETTER(&TestUpDownGroup::GetFloat), new FloatEditor(-1000,1000,1,UpDown) );
- }
-
-private:
- float GetFloat() const{return( m_fFloat1 );}
- void SetFloat( float fValue ){m_fFloat1 = fValue;}
- double GetDouble() const{return( m_dDouble );}
- void SetDouble( double dValue ){m_dDouble = dValue;}
- double GetDouble2() const{return( m_dDouble2 );}
- void SetDouble2( double dValue ){m_dDouble2 = dValue;}
- int GetInt() const{return( m_iInt1 );}
- void SetInt( int iValue ){m_iInt1 = iValue;}
-
-
- float m_fFloat1;
- double m_dDouble;
- double m_dDouble2;
- int m_iInt1;
-};
-
-class TestActionsFixture : public property_group
-{
-public:
-#if defined(BOOST_MSVC)
- #pragma warning(push)
- #pragma warning( disable: 4355 )
-#endif
- TestActionsFixture() : property_group( PROPERTY_GROUP_NAME, NULL )
- {
- bTriggeredAction1 = false;
- bTriggeredAction2 = false;
-
- add_action(ACTION_1, "First BOOST_ACTION", BOOST_ACTION(&TestActionsFixture::Action1));
- add_action(ACTION_2, "Second BOOST_ACTION", BOOST_ACTION(&TestActionsFixture::Action2));
- }
-#if defined(BOOST_MSVC)
- #pragma warning(pop)
-#endif
-
- void clear_actions()
- {
- m_actions.clear();
- }
-
- void Action1(){bTriggeredAction1 = true;}
- void Action2(){bTriggeredAction2 = true;}
-
- bool bTriggeredAction1;
- bool bTriggeredAction2;
-};
-
-class TestPropertySerializer : public property_group
-{
-public:
- TestPropertySerializer( property_group *pParentGroup) : property_group( "TestPropertySerializer", pParentGroup )
- {
- m_fFloat1 = 2.45f;
- m_iInt1 = 365;
- m_strString2 = "test value";
-
- 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:
- string GetName() const {return "aName";}
- float GetFloat() const{return( m_fFloat1 );}
- void SetFloat( float fValue ){m_fFloat1 = fValue;}
- int GetInt() const{return( m_iInt1 );}
- void SetInt( int iValue ){m_iInt1 = iValue;}
- string GetPropertyString2(){return( m_strString2 );}
- void SetPropertyString2( string strValue ){m_strString2 = strValue;}
-
- float m_fFloat1;
- int m_iInt1;
- string m_strString2;
-};
\ No newline at end of file

Deleted: sandbox/pinhole/libs/pinhole/test/UtilityMisc.hpp
==============================================================================
--- sandbox/pinhole/libs/pinhole/test/UtilityMisc.hpp 2007-12-05 18:44:39 EST (Wed, 05 Dec 2007)
+++ (empty file)
@@ -1,65 +0,0 @@
-// Boost.Print library
-
-// Copyright Jared McIntyre 2007. Use, modification and
-// distribution is subject to the Boost Software License, Version
-// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-// For more information, see http://www.boost.org
-
-#include <windows.h>
-
-#include <string>
-#include <boost/algorithm/string.hpp>
-#include <boost/algorithm/string/find.hpp>
-#include <boost/filesystem/operations.hpp>
-#include <boost/filesystem/fstream.hpp>
-
-using namespace std;
-using namespace boost;
-
-string getPathForModule(const char* szModuleName)
-{
- TCHAR buf[MAX_PATH] = "";
- HMODULE hModule = ::GetModuleHandle(szModuleName);
- ::GetModuleFileName(hModule, buf, sizeof(buf));
- string strExePath(buf);
- return strExePath;
-}
-
-string getParentDirectory(int nRelativePathLevel)
-{
- string strExePath = getPathForModule(NULL);
-
- filesystem::path full_path = filesystem::system_complete( filesystem::path(strExePath.c_str(), filesystem::native ));
- for(int nLevel = 0; nLevel < nRelativePathLevel; nLevel++)
- {
- full_path = full_path.branch_path();
- }
- string strFullPathLocal = full_path.string();
- string strParent = strFullPathLocal + "\\";
- return strParent;
-}
-
-string getTestDataDirectory()
-{
- string strBranchPath = getParentDirectory(3);
- string strTestDataDirectory = strBranchPath + "UnitTests\\TestProperties\\Test Data Files\\";
- return strTestDataDirectory;
-}
-
-class MscCurrentDirectoryHelper
-{
-public:
- MscCurrentDirectoryHelper(const char* newDir)
- {
- GetCurrentDirectory(MAX_PATH, m_oldCurrentPath);
- SetCurrentDirectory(newDir);
- }
- ~MscCurrentDirectoryHelper()
- {
- SetCurrentDirectory(m_oldCurrentPath);
- }
-private:
- char m_oldCurrentPath[MAX_PATH];
-};

Modified: sandbox/pinhole/libs/pinhole/test/test_actions.cpp
==============================================================================
--- sandbox/pinhole/libs/pinhole/test/test_actions.cpp (original)
+++ sandbox/pinhole/libs/pinhole/test/test_actions.cpp 2007-12-05 18:44:39 EST (Wed, 05 Dec 2007)
@@ -8,8 +8,47 @@
 // For more information, see http://www.boost.org
 
 #define BOOST_TEST_MODULE PinholeLib
+
+#include <boost/pinhole.hpp>
 #include <boost/test/unit_test.hpp>
-#include "TestClassesAndConstants.hpp"
+
+using namespace std;
+using namespace boost;
+using namespace boost::pinhole;
+
+#define ACTION_1 ("BOOST_ACTION 1")
+#define ACTION_2 ("BOOST_ACTION 2")
+
+class TestActionsFixture : public property_group
+{
+public:
+#if defined(BOOST_MSVC)
+#pragma warning(push)
+#pragma warning( disable: 4355 )
+#endif
+ TestActionsFixture() : property_group( "PropertyGroupName", NULL )
+ {
+ bTriggeredAction1 = false;
+ bTriggeredAction2 = false;
+
+ add_action(ACTION_1, "First BOOST_ACTION", BOOST_ACTION(&TestActionsFixture::Action1));
+ add_action(ACTION_2, "Second BOOST_ACTION", BOOST_ACTION(&TestActionsFixture::Action2));
+ }
+#if defined(BOOST_MSVC)
+#pragma warning(pop)
+#endif
+
+ void clear_actions()
+ {
+ m_actions.clear();
+ }
+
+ void Action1(){bTriggeredAction1 = true;}
+ void Action2(){bTriggeredAction2 = true;}
+
+ bool bTriggeredAction1;
+ bool bTriggeredAction2;
+};
 
 BOOST_AUTO_TEST_CASE( TestTriggerAction )
 {

Modified: sandbox/pinhole/libs/pinhole/test/test_bool_properties.cpp
==============================================================================
--- sandbox/pinhole/libs/pinhole/test/test_bool_properties.cpp (original)
+++ sandbox/pinhole/libs/pinhole/test/test_bool_properties.cpp 2007-12-05 18:44:39 EST (Wed, 05 Dec 2007)
@@ -28,8 +28,8 @@
         m_bool_Func = false;
             m_bool_Var = false;
 
- add_property("Bool_Func", "Bool1 description", BOOST_SETTER(&TestGroup::SetBool), BOOST_GETTER(&TestGroup::GetBool), NULL );
- add_property("Bool_Var", "Bool2 description", BOOST_SETTER_VAR(m_bool_Var), BOOST_GETTER_VAR(m_bool_Var), NULL );
+ add_property("Bool_Func", "Bool1 description", BOOST_SETTER(&TestGroup::SetBool), BOOST_GETTER(&TestGroup::GetBool) );
+ add_property("Bool_Var", "Bool2 description", BOOST_SETTER_VAR(m_bool_Var), BOOST_GETTER_VAR(m_bool_Var) );
         }
 #if defined(BOOST_MSVC)
     #pragma warning(pop)
@@ -48,40 +48,70 @@
     TestGroup testGroup;
     
         testGroup.set( "Bool_Func", true );
- BOOST_CHECK_EQUAL( true, testGroup.get<bool>( "Bool_Func") );
+ BOOST_CHECK_EQUAL( true, testGroup.get<bool>("Bool_Func") );
 
         testGroup.set( "Bool_Func", false );
- BOOST_CHECK_EQUAL( false, testGroup.get<bool>( "Bool_Func") );
+ BOOST_CHECK_EQUAL( false, testGroup.get<bool>("Bool_Func") );
     
         testGroup.set_as_string( "Bool_Func", "true" );
- BOOST_CHECK_EQUAL( "True", testGroup.get_as_string( "Bool_Func") );
+ BOOST_CHECK_EQUAL( "True", testGroup.get_as_string("Bool_Func") );
 
         testGroup.set_as_string( "Bool_Func", "false" );
- BOOST_CHECK_EQUAL( "False", testGroup.get_as_string( "Bool_Func") );
+ BOOST_CHECK_EQUAL( "False", testGroup.get_as_string("Bool_Func") );
     
         testGroup.set_as_string( "Bool_Func", "True" );
- BOOST_CHECK_EQUAL( "True", testGroup.get_as_string( "Bool_Func") );
+ BOOST_CHECK_EQUAL( "True", testGroup.get_as_string("Bool_Func") );
 
         testGroup.set_as_string( "Bool_Func", "False" );
- BOOST_CHECK_EQUAL( "False", testGroup.get_as_string( "Bool_Func") );
+ BOOST_CHECK_EQUAL( "False", testGroup.get_as_string("Bool_Func") );
     
         testGroup.set_as_string( "Bool_Func", "TrUe" );
- BOOST_CHECK_EQUAL( "True", testGroup.get_as_string( "Bool_Func") );
+ BOOST_CHECK_EQUAL( "True", testGroup.get_as_string("Bool_Func") );
 
         testGroup.set_as_string( "Bool_Func", "FalSe" );
- BOOST_CHECK_EQUAL( "False", testGroup.get_as_string( "Bool_Func") );
+ BOOST_CHECK_EQUAL( "False", testGroup.get_as_string("Bool_Func") );
     
         testGroup.set_as_string( "Bool_Func", "TRUE" );
- BOOST_CHECK_EQUAL( "True", testGroup.get_as_string( "Bool_Func") );
+ BOOST_CHECK_EQUAL( "True", testGroup.get_as_string("Bool_Func") );
 
         testGroup.set_as_string( "Bool_Func", "FALSE" );
- BOOST_CHECK_EQUAL( "False", testGroup.get_as_string( "Bool_Func") );
+ BOOST_CHECK_EQUAL( "False", testGroup.get_as_string("Bool_Func") );
     
         testGroup.set_as_string( "Bool_Func", "1" );
- BOOST_CHECK_EQUAL( "True", testGroup.get_as_string( "Bool_Func") );
+ BOOST_CHECK_EQUAL( "True", testGroup.get_as_string("Bool_Func") );
 
         testGroup.set_as_string( "Bool_Func", "0" );
- BOOST_CHECK_EQUAL( "False", testGroup.get_as_string( "Bool_Func") );
+ BOOST_CHECK_EQUAL( "False", testGroup.get_as_string("Bool_Func") );
+
+ testGroup.set_as_wstring( "Bool_Func", L"true" );
+ BOOST_CHECK( L"True" == testGroup.get_as_wstring("Bool_Func") );
+
+ testGroup.set_as_wstring( "Bool_Func", L"false" );
+ BOOST_CHECK( L"False" == testGroup.get_as_wstring("Bool_Func") );
+
+ testGroup.set_as_wstring( "Bool_Func", L"True" );
+ BOOST_CHECK( L"True" == testGroup.get_as_wstring("Bool_Func") );
+
+ testGroup.set_as_wstring( "Bool_Func", L"False" );
+ BOOST_CHECK( L"False" == testGroup.get_as_wstring("Bool_Func") );
+
+ testGroup.set_as_wstring( "Bool_Func", L"TrUe" );
+ BOOST_CHECK( L"True" == testGroup.get_as_wstring("Bool_Func") );
+
+ testGroup.set_as_wstring( "Bool_Func", L"FalSe" );
+ BOOST_CHECK( L"False" == testGroup.get_as_wstring("Bool_Func") );
+
+ testGroup.set_as_wstring( "Bool_Func", L"TRUE" );
+ BOOST_CHECK( L"True" == testGroup.get_as_wstring("Bool_Func") );
+
+ testGroup.set_as_wstring( "Bool_Func", L"FALSE" );
+ BOOST_CHECK( L"False" == testGroup.get_as_wstring("Bool_Func") );
+
+ testGroup.set_as_wstring( "Bool_Func", L"1" );
+ BOOST_CHECK( L"True" == testGroup.get_as_wstring("Bool_Func") );
+
+ testGroup.set_as_wstring( "Bool_Func", L"0" );
+ BOOST_CHECK( L"False" == testGroup.get_as_wstring("Bool_Func") );
 }
 
 BOOST_AUTO_TEST_CASE( TestSetGetBool_Var )
@@ -123,6 +153,36 @@
 
         testGroup.set_as_string( "Bool_Var", "0" );
         BOOST_CHECK_EQUAL( "False", testGroup.get_as_string( "Bool_Var") );
+
+ testGroup.set_as_wstring( "Bool_Var", L"true" );
+ BOOST_CHECK( L"True" == testGroup.get_as_wstring( "Bool_Var") );
+
+ testGroup.set_as_wstring( "Bool_Var", L"false" );
+ BOOST_CHECK( L"False" == testGroup.get_as_wstring( "Bool_Var") );
+
+ testGroup.set_as_wstring( "Bool_Var", L"True" );
+ BOOST_CHECK( L"True" == testGroup.get_as_wstring( "Bool_Var") );
+
+ testGroup.set_as_wstring( "Bool_Var", L"False" );
+ BOOST_CHECK( L"False" == testGroup.get_as_wstring( "Bool_Var") );
+
+ testGroup.set_as_wstring( "Bool_Var", L"TrUe" );
+ BOOST_CHECK( L"True" == testGroup.get_as_wstring( "Bool_Var") );
+
+ testGroup.set_as_wstring( "Bool_Var", L"FalSe" );
+ BOOST_CHECK( L"False" == testGroup.get_as_wstring( "Bool_Var") );
+
+ testGroup.set_as_wstring( "Bool_Var", L"TRUE" );
+ BOOST_CHECK( L"True" == testGroup.get_as_wstring( "Bool_Var") );
+
+ testGroup.set_as_wstring( "Bool_Var", L"FALSE" );
+ BOOST_CHECK( L"False" == testGroup.get_as_wstring( "Bool_Var") );
+
+ testGroup.set_as_wstring( "Bool_Var", L"1" );
+ BOOST_CHECK( L"True" == testGroup.get_as_wstring( "Bool_Var") );
+
+ testGroup.set_as_wstring( "Bool_Var", L"0" );
+ BOOST_CHECK( L"False" == testGroup.get_as_wstring( "Bool_Var") );
 }
 
 BOOST_AUTO_TEST_CASE( TestBoolPropertyType )

Modified: sandbox/pinhole/libs/pinhole/test/test_double_properties.cpp
==============================================================================
--- sandbox/pinhole/libs/pinhole/test/test_double_properties.cpp (original)
+++ sandbox/pinhole/libs/pinhole/test/test_double_properties.cpp 2007-12-05 18:44:39 EST (Wed, 05 Dec 2007)
@@ -28,8 +28,8 @@
         m_double_Func = 1.1;
             m_double_Var = 1.1;
 
- add_property("Double_Func", "Double1 description", BOOST_SETTER(&TestGroup::SetDouble), BOOST_GETTER(&TestGroup::GetDouble), NULL );
- add_property("Double_Var", "Double2 description", BOOST_SETTER_VAR(m_double_Var), BOOST_GETTER_VAR(m_double_Var), NULL );
+ add_property("Double_Func", "Double1 description", BOOST_SETTER(&TestGroup::SetDouble), BOOST_GETTER(&TestGroup::GetDouble) );
+ add_property("Double_Var", "Double2 description", BOOST_SETTER_VAR(m_double_Var), BOOST_GETTER_VAR(m_double_Var) );
         }
 #if defined(BOOST_MSVC)
     #pragma warning(pop)
@@ -48,11 +48,15 @@
     TestGroup testGroup;
 
         testGroup.set( "Double_Func", 2.2 );
- BOOST_CHECK_EQUAL( 2.2, testGroup.get<double>( "Double_Func") );
+ BOOST_CHECK_EQUAL( 2.2, testGroup.get<double>("Double_Func") );
     
         testGroup.set_as_string( "Double_Func", "3.3" );
- //BOOST_CHECK_EQUAL( "3.3", testGroup.get_as_string( "Double_Func") );
- BOOST_CHECK_EQUAL( 3.3, testGroup.get<double>( "Double_Func") );
+ //BOOST_CHECK_EQUAL( "3.3", testGroup.get_as_string("Double_Func") );
+ BOOST_CHECK_EQUAL( 3.3, testGroup.get<double>("Double_Func") );
+
+ testGroup.set_as_wstring( "Double_Func", L"4.4" );
+ //BOOST_CHECK_EQUAL( L"4.4", testGroup.get_as_wstring("Double_Func") );
+ BOOST_CHECK_EQUAL( 4.4, testGroup.get<double>("Double_Func") );
 }
 
 BOOST_AUTO_TEST_CASE( TestSetGetDouble_Var )
@@ -60,11 +64,15 @@
     TestGroup testGroup;
 
         testGroup.set( "Double_Var", 2.2 );
- BOOST_CHECK_EQUAL( 2.2, testGroup.get<double>( "Double_Var") );
+ BOOST_CHECK_EQUAL( 2.2, testGroup.get<double>("Double_Var") );
     
         testGroup.set_as_string( "Double_Var", "3.3" );
- //BOOST_CHECK_EQUAL( "3.3", testGroup.get_as_string( "Double_Var") );
- BOOST_CHECK_EQUAL( 3.3, testGroup.get<double>( "Double_Var") );
+ //BOOST_CHECK_EQUAL( "3.3", testGroup.get_as_string("Double_Var") );
+ BOOST_CHECK_EQUAL( 3.3, testGroup.get<double>("Double_Var") );
+
+ testGroup.set_as_wstring( "Double_Var", L"4.4" );
+ //BOOST_CHECK_EQUAL( L"4.4", testGroup.get_as_wstring("Double_Var") );
+ BOOST_CHECK_EQUAL( 4.4, testGroup.get<double>("Double_Var") );
 }
 
 BOOST_AUTO_TEST_CASE( TestDoublePropertyType )
@@ -82,5 +90,6 @@
 {
     TestGroup testGroup;
     
- BOOST_CHECK_THROW( testGroup.set_as_string( "Double_Func", "Foo" ), std::invalid_argument );
+ BOOST_CHECK_THROW( testGroup.set_as_string( "Double_Func", "Foo" ), std::invalid_argument );
+ BOOST_CHECK_THROW( testGroup.set_as_wstring( "Double_Func", L"Foo" ), std::invalid_argument );
 }

Modified: sandbox/pinhole/libs/pinhole/test/test_float_properties.cpp
==============================================================================
--- sandbox/pinhole/libs/pinhole/test/test_float_properties.cpp (original)
+++ sandbox/pinhole/libs/pinhole/test/test_float_properties.cpp 2007-12-05 18:44:39 EST (Wed, 05 Dec 2007)
@@ -28,8 +28,8 @@
         m_float_Func = 1.1f;
             m_float_Var = 1.1f;
 
- add_property("Float_Func", "Float description", BOOST_SETTER(&TestGroup::SetFloat), BOOST_GETTER(&TestGroup::GetFloat), NULL );
- add_property("Float_Var", "Float description", BOOST_SETTER_VAR(m_float_Var), BOOST_GETTER_VAR(m_float_Var), NULL );
+ add_property("Float_Func", "Float description", BOOST_SETTER(&TestGroup::SetFloat), BOOST_GETTER(&TestGroup::GetFloat) );
+ add_property("Float_Var", "Float description", BOOST_SETTER_VAR(m_float_Var), BOOST_GETTER_VAR(m_float_Var) );
         }
 #if defined(BOOST_MSVC)
     #pragma warning(pop)
@@ -48,11 +48,15 @@
     TestGroup testGroup;
 
         testGroup.set( "Float_Func", 2.2f );
- BOOST_CHECK_EQUAL( 2.2f, testGroup.get<float>( "Float_Func") );
+ BOOST_CHECK_EQUAL( 2.2f, testGroup.get<float>("Float_Func") );
     
         testGroup.set_as_string( "Float_Func", "3.3" );
- //BOOST_CHECK_EQUAL( "3.3", testGroup.get_as_string( "Float_Func") );
- BOOST_CHECK_EQUAL( 3.3f, testGroup.get<float>( "Float_Func") );
+ //BOOST_CHECK_EQUAL( "3.3", testGroup.get_as_string("Float_Func") );
+ BOOST_CHECK_EQUAL( 3.3f, testGroup.get<float>("Float_Func") );
+
+ testGroup.set_as_wstring( "Float_Func", L"4.4" );
+ //BOOST_CHECK_EQUAL( "4.4", testGroup.get_as_wstring("Float_Func") );
+ BOOST_CHECK_EQUAL( 4.4f, testGroup.get<float>("Float_Func") );
 }
 
 BOOST_AUTO_TEST_CASE( TestSetGetFloat_Var )
@@ -63,8 +67,12 @@
         BOOST_CHECK_EQUAL( 2.2f, testGroup.get<float>( "Float_Var") );
     
         testGroup.set_as_string( "Float_Var", "3.3" );
- //BOOST_CHECK_EQUAL( "3.3", testGroup.get_as_string( "Float_Var") );
- BOOST_CHECK_EQUAL( 3.3f, testGroup.get<float>( "Float_Var") );
+ //BOOST_CHECK_EQUAL( "3.3", testGroup.get_as_string("Float_Var") );
+ BOOST_CHECK_EQUAL( 3.3f, testGroup.get<float>("Float_Var") );
+
+ testGroup.set_as_wstring( "Float_Var", L"4.4" );
+ //BOOST_CHECK_EQUAL( "4.4", testGroup.get_as_wstring("Float_Var") );
+ BOOST_CHECK_EQUAL( 4.4f, testGroup.get<float>("Float_Var") );
 }
 
 BOOST_AUTO_TEST_CASE( TestFloatPropertyType )
@@ -82,5 +90,6 @@
 {
     TestGroup testGroup;
     
- BOOST_CHECK_THROW( testGroup.set_as_string( "Float_Func", "Foo" ), std::invalid_argument );
+ BOOST_CHECK_THROW( testGroup.set_as_string( "Float_Func", "Foo" ), std::invalid_argument );
+ BOOST_CHECK_THROW( testGroup.set_as_wstring( "Float_Func", L"Foo" ), std::invalid_argument );
 }

Modified: sandbox/pinhole/libs/pinhole/test/test_integer_properties.cpp
==============================================================================
--- sandbox/pinhole/libs/pinhole/test/test_integer_properties.cpp (original)
+++ sandbox/pinhole/libs/pinhole/test/test_integer_properties.cpp 2007-12-05 18:44:39 EST (Wed, 05 Dec 2007)
@@ -28,8 +28,8 @@
         m_int_Func = 0;
             m_int_Var = 0;
 
- add_property("Int_Func", "Int1 description", BOOST_SETTER(&TestGroup::SetInt), BOOST_GETTER(&TestGroup::GetInt), NULL );
- add_property("Int_Var", "Int2 description", BOOST_SETTER_VAR(m_int_Var), BOOST_GETTER_VAR(m_int_Var), NULL );
+ add_property("Int_Func", "Int1 description", BOOST_SETTER(&TestGroup::SetInt), BOOST_GETTER(&TestGroup::GetInt) );
+ add_property("Int_Var", "Int2 description", BOOST_SETTER_VAR(m_int_Var), BOOST_GETTER_VAR(m_int_Var) );
         }
 #if defined(BOOST_MSVC)
     #pragma warning(pop)
@@ -48,10 +48,13 @@
     TestGroup testGroup;
 
         testGroup.set( "Int_Func", 1 );
- BOOST_CHECK_EQUAL( 1, testGroup.get<int>( "Int_Func") );
+ BOOST_CHECK_EQUAL( 1, testGroup.get<int>("Int_Func") );
     
         testGroup.set_as_string( "Int_Func", "2" );
- BOOST_CHECK_EQUAL( "2", testGroup.get_as_string( "Int_Func") );
+ BOOST_CHECK_EQUAL( "2", testGroup.get_as_string("Int_Func") );
+
+ testGroup.set_as_wstring( "Int_Func", L"3" );
+ BOOST_CHECK( L"3" == testGroup.get_as_wstring("Int_Func") );
 }
 
 BOOST_AUTO_TEST_CASE( TestIntegerSetGet_Var )
@@ -59,10 +62,13 @@
     TestGroup testGroup;
 
         testGroup.set( "Int_Var", 1 );
- BOOST_CHECK_EQUAL( 1, testGroup.get<int>( "Int_Var") );
+ BOOST_CHECK_EQUAL( 1, testGroup.get<int>("Int_Var") );
     
         testGroup.set_as_string( "Int_Var", "2" );
- BOOST_CHECK_EQUAL( "2", testGroup.get_as_string( "Int_Var") );
+ BOOST_CHECK_EQUAL( "2", testGroup.get_as_string("Int_Var") );
+
+ testGroup.set_as_wstring( "Int_Var", L"3" );
+ BOOST_CHECK( L"3" == testGroup.get_as_wstring("Int_Var") );
 }
 
 BOOST_AUTO_TEST_CASE( TestIntegerEditorType )
@@ -80,5 +86,6 @@
 {
     TestGroup testGroup;
     
- BOOST_CHECK_THROW( testGroup.set_as_string( "Int_Func", "Foo" ), std::invalid_argument );
+ BOOST_CHECK_THROW( testGroup.set_as_string( "Int_Func", "Foo" ), std::invalid_argument );
+ BOOST_CHECK_THROW( testGroup.set_as_wstring( "Int_Func", L"Foo" ), std::invalid_argument );
 }

Deleted: sandbox/pinhole/libs/pinhole/test/test_property_group_wrapper.cpp
==============================================================================
--- sandbox/pinhole/libs/pinhole/test/test_property_group_wrapper.cpp 2007-12-05 18:44:39 EST (Wed, 05 Dec 2007)
+++ (empty file)
@@ -1,149 +0,0 @@
-// Boost.Pinhole library
-
-// Copyright Jared McIntyre 2007. Use, modification and
-// distribution is subject to the Boost Software License, Version
-// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-// For more information, see http://www.boost.org
-
-#define BOOST_TEST_MODULE PinholeLib
-#include <boost/test/unit_test.hpp>
-#include "TestClassesAndConstants.hpp"
-#include <boost/pinhole.hpp>
-
-BOOST_AUTO_TEST_CASE( TestPropertyGroupWrapper_Bool )
-{
- TestPropertyGroup_4 baseObject;
- property_group_wrapper wrapper("test_wrapper", &baseObject);
- const Editor *pEditor;
-
- // Test Standard Creation
- 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 );
-
- wrapper.set_as_string( PROPERTY_BOOL, BOOL_TRUE );
- BOOST_CHECK( wrapper.get_as_string( PROPERTY_BOOL ) == BOOL_TRUE );
-
- pEditor = wrapper.get_metadata( PROPERTY_BOOL );
- BOOST_CHECK( pEditor->getEditorPropertyType() == BooleanType );
- BOOST_CHECK( pEditor->GetControlType() == Radio );
-
- // Test Auto-Generated Designer Creation
- property_group_wrapper wrapperAutoGenDesigner("test_wrapper", &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) );
-}
-
-BOOST_AUTO_TEST_CASE( TestPropertyGroupWrapper_Double )
-{
- TestPropertyGroup_5 baseObject;
- property_group_wrapper wrapper("test_wrapper", &baseObject);
- const Editor *pEditor;
-
- // Test Standard Creation
- 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 );
- BOOST_CHECK( from_string<double>(dValue, wrapper.get_as_string( PROPERTY_DOUBLE), std::dec) );
- BOOST_CHECK_EQUAL( dValue, PROPERTY_DOUBLE_VALUE );
-
- pEditor = wrapper.get_metadata( PROPERTY_DOUBLE );
- BOOST_CHECK( pEditor->getEditorPropertyType() == DoubleType );
- BOOST_CHECK( pEditor->GetControlType() == EditBox );
-
- // Test Auto-Generated Designer Creation
- property_group_wrapper wrapperAutoGenDesigner("test_wrapper", &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) );
-}
-
-BOOST_AUTO_TEST_CASE( TestPropertyGroupWrapper_Float )
-{
- TestPropertyGroup_4 baseObject;
- property_group_wrapper wrapper("test_wrapper", &baseObject);
- const Editor *pEditor;
-
- // Test Standard Creation
- 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 );
- BOOST_CHECK( from_string<float>(fValue, wrapper.get_as_string(PROPERTY_FLOAT_1), std::dec) );
- BOOST_CHECK_EQUAL( fValue, PROPERTY_FLOAT_1_VALUE );
-
- pEditor = wrapper.get_metadata( PROPERTY_FLOAT_1 );
- BOOST_CHECK( pEditor->getEditorPropertyType() == FloatType );
- BOOST_CHECK( pEditor->GetControlType() == EditBox );
-
- // Test Auto-Generated Designer Creation
- property_group_wrapper wrapperAutoGenDesigner("test_wrapper", &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) );
-}
-
-BOOST_AUTO_TEST_CASE( TestPropertyGroupWrapper_Integer )
-{
- TestPropertyGroup_4 baseObject;
- property_group_wrapper wrapper("test_wrapper", &baseObject);
- const Editor *pEditor;
-
- // Test Standard Creation
- 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 );
- BOOST_CHECK( from_string<int>(iValue, wrapper.get_as_string(PROPERTY_INT_1), std::dec) );
- BOOST_CHECK_EQUAL( iValue, PROPERTY_INT_1_VALUE );
-
- pEditor = wrapper.get_metadata( PROPERTY_INT_1 );
- BOOST_CHECK( pEditor->getEditorPropertyType() == IntegerType );
- BOOST_CHECK( pEditor->GetControlType() == DropDown );
-
- // Test Auto-Generated Designer Creation
- property_group_wrapper wrapperAutoGenDesigner("test_wrapper", &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) );
-}
-
-BOOST_AUTO_TEST_CASE( TestPropertyGroupWrapper_String )
-{
- TestPropertyGroup baseObject;
- property_group_wrapper wrapper("test_wrapper", &baseObject);
- const Editor *pEditor;
-
- // Test Standard Creation
- 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) );
- wrapper.set_as_string( PROPERTY_STRING_2, PROPERTY_STRING_1_VALUE );
- BOOST_CHECK( PROPERTY_STRING_1_VALUE == wrapper.get_as_string( PROPERTY_STRING_2) );
-
- pEditor = wrapper.get_metadata( PROPERTY_STRING_2 );
- BOOST_CHECK( pEditor->getEditorPropertyType() == StringType );
- BOOST_CHECK( pEditor->GetControlType() == EditBox );
-
- // Test Auto-Generated Designer Creation
- property_group_wrapper wrapperAutoGenDesigner("test_wrapper", &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) );
-}
\ No newline at end of file

Modified: sandbox/pinhole/libs/pinhole/test/test_property_groups.cpp
==============================================================================
--- sandbox/pinhole/libs/pinhole/test/test_property_groups.cpp (original)
+++ sandbox/pinhole/libs/pinhole/test/test_property_groups.cpp 2007-12-05 18:44:39 EST (Wed, 05 Dec 2007)
@@ -9,9 +9,97 @@
 
 #define BOOST_TEST_MODULE PinholeLib
 #include <boost/test/unit_test.hpp>
-#include "TestClassesAndConstants.hpp"
 #include <boost/pinhole.hpp>
 
+using namespace std;
+using namespace boost;
+using namespace boost::pinhole;
+
+#define PROPERTY_GROUP_NAME ("TestPropertyGroup")
+#define PROPERTY_GROUP_CATEGORY1 ("MyPropertyGroupCategory1")
+#define PROPERTY_GROUP_CATEGORY2 ("MyPropertyGroupCategory2")
+#define PROPERTY_GROUP_CATEGORY3 ("MyPropertyGroupCategory3")
+#define PROPERTY_GROUP_CHILD_NAME ("TestPropertyChildGroup")
+
+#define PROP_STRING ("PropString")
+#define PROP_STRING_VALUE ("PropString_Value")
+
+#define PROP_FLOAT ("PropFloat")
+#define PROP_FLOAT_VALUE ( 3.14161f )
+#define PROP_FLOAT_STRING_VALUE ( "3.14161" )
+
+#define PROP_INT ("PropInt")
+#define PROP_INT_VALUE (54321)
+
+#define PROPERTY_BOOL ("PropBool")
+#define PROPERTY_BOOL_VALUE ("True")
+
+class TestPropertyChildGroup : public property_group
+{
+public:
+ TestPropertyChildGroup( property_group *pParentGroup) : property_group( PROPERTY_GROUP_CHILD_NAME, pParentGroup )
+ {
+ add_property(PROP_FLOAT, "PropFloat description", BOOST_SETTER(&TestPropertyChildGroup::SetFloat), BOOST_GETTER(&TestPropertyChildGroup::GetFloat));
+ add_property(PROP_INT, "PropInt description", BOOST_SETTER(&TestPropertyChildGroup::SetInt), BOOST_GETTER(&TestPropertyChildGroup::GetInt));
+ add_property(PROP_STRING, "PropString description", BOOST_SETTER(&TestPropertyChildGroup::SetString), BOOST_GETTER(&TestPropertyChildGroup::GetString));
+ }
+
+ float GetFloat() const{return( m_float );}
+ void SetFloat( float fValue ){m_float = fValue;}
+ int GetInt() const{return( m_int );}
+ void SetInt( int iValue ){m_int = iValue;}
+ string GetString(){return( m_string );}
+ void SetString( string strValue ){m_string = strValue;}
+
+ float m_float;
+ int m_int;
+ string m_string;
+};
+
+class TestPropertyGroup : public property_group
+{
+public:
+#if defined(BOOST_MSVC)
+#pragma warning(push)
+#pragma warning( disable: 4355 )
+#endif
+ TestPropertyGroup() : property_group( PROPERTY_GROUP_NAME, NULL ), m_child1( this ), m_child2( this )
+ {
+ m_bool_var = false;
+
+ add_property(PROP_STRING, "PropString description", BOOST_SETTER(&TestPropertyGroup::SetString), BOOST_GETTER(&TestPropertyGroup::GetString));
+ add_property(PROP_FLOAT, "PropFloat description", BOOST_SETTER(&TestPropertyGroup::SetFloat), BOOST_GETTER(&TestPropertyGroup::GetFloat));
+ add_property(PROP_INT, "PropInt description", BOOST_SETTER(&TestPropertyGroup::SetInt), BOOST_GETTER(&TestPropertyGroup::GetInt));
+ add_property(PROPERTY_BOOL, "PropBool description", BOOST_SETTER(&TestPropertyGroup::SetBool), BOOST_GETTER(&TestPropertyGroup::GetBool));
+ }
+#if defined(BOOST_MSVC)
+#pragma warning(pop)
+#endif
+
+ TestPropertyChildGroup m_child1;
+ TestPropertyChildGroup m_child2;
+
+ float GetFloat() const{return( m_float );}
+ void SetFloat( float fValue ){m_float = fValue;}
+ int GetInt() const{return( m_int );}
+ void SetInt( int iValue ){m_int = iValue;}
+ string GetString(){return( m_string );}
+ void SetString( string strValue ){m_string = strValue;}
+ void SetBool( bool b ){ m_bool = b; }
+ bool GetBool(){ return( m_bool ); }
+
+private:
+ float m_float;
+ int m_int;
+ string m_string;
+ bool m_bool;
+
+ float m_float_var;
+ int m_int_var;
+ string m_string_var;
+ bool m_bool_var;
+};
+
 class TestPropertyManager : public property_manager
 {
 public:
@@ -83,7 +171,7 @@
 {
         TestPropertyGroup testGroup;
         
- BOOST_CHECK( testGroup.get_parent() == NULL );
+ BOOST_CHECK( NULL == testGroup.get_parent() );
         BOOST_CHECK( testGroup.m_child1.get_parent() == (property_group*)&testGroup );
 }
 
@@ -91,12 +179,12 @@
 {
         TestPropertyGroup testGroup;
         
- BOOST_CHECK( testGroup.get_name() == PROPERTY_GROUP_NAME );
+ BOOST_CHECK_EQUAL( PROPERTY_GROUP_NAME, testGroup.get_name() );
 }
 
 BOOST_AUTO_TEST_CASE( TestBogusPropertyNameForEditor )
 {
- TestPropertyGroup_4 testGroup;
+ TestPropertyGroup testGroup;
         
         BOOST_CHECK_THROW( testGroup.get_metadata( "bogus property name" ), std::out_of_range );
 }
@@ -108,36 +196,48 @@
 
 BOOST_AUTO_TEST_CASE( TestNumberOfProperties )
 {
- TestPropertyGroup_5 testGroup;
+ bool test_bool(false);
+ property_group testGroup("TEST_GROUP", NULL);
         
- BOOST_CHECK_EQUAL( testGroup.prop_count(), 7u );
+ BOOST_CHECK_EQUAL( testGroup.prop_count(), 0u );
+
+ testGroup.add_property("Test1", "", BOOST_SETTER_NONE, BOOST_GETTER_VAR(test_bool));
+ BOOST_CHECK_EQUAL( testGroup.prop_count(), 1u );
+
+ testGroup.add_property("Test2", "", BOOST_SETTER_NONE, BOOST_GETTER_VAR(test_bool));
+ BOOST_CHECK_EQUAL( testGroup.prop_count(), 2u );
+
+ testGroup.add_property("Test3", "", BOOST_SETTER_NONE, BOOST_GETTER_VAR(test_bool));
+ BOOST_CHECK_EQUAL( testGroup.prop_count(), 3u );
+
+ testGroup.add_property("Test4", "", BOOST_SETTER_NONE, BOOST_GETTER_VAR(test_bool));
+ BOOST_CHECK_EQUAL( testGroup.prop_count(), 4u );
+
+ testGroup.add_property("Test5", "", BOOST_SETTER_NONE, BOOST_GETTER_VAR(test_bool));
+ BOOST_CHECK_EQUAL( testGroup.prop_count(), 5u );
 }
 
 BOOST_AUTO_TEST_CASE( TestPropertyIteration )
 {
- TestPropertyGroup_5 testGroup;
+ TestPropertyGroup testGroup;
         
+ // Note: This is a map, the order is alphabetical on string name
+
         property_group::prop_iterator itr = testGroup.prop_begin();
     BOOST_CHECK_EQUAL( (*itr), PROPERTY_BOOL );
     ++itr;
- BOOST_CHECK_EQUAL( (*itr), PROPERTY_DOUBLE );
- ++itr;
- BOOST_CHECK_EQUAL( (*itr), PROPERTY_DOUBLE_2 );
+ BOOST_CHECK_EQUAL( (*itr), PROP_FLOAT );
     ++itr;
- BOOST_CHECK_EQUAL( (*itr), PROPERTY_DOUBLE_VAR );
+ BOOST_CHECK_EQUAL( (*itr), PROP_INT );
     ++itr;
- BOOST_CHECK_EQUAL( (*itr), PROPERTY_FLOAT_1 );
- ++itr;
- BOOST_CHECK_EQUAL( (*itr), PROPERTY_INT_1 );
- ++itr;
- BOOST_CHECK_EQUAL( (*itr), PROPERTY_STRING_2 );
+ BOOST_CHECK_EQUAL( (*itr), PROP_STRING );
     ++itr;
     BOOST_CHECK( testGroup.prop_end() == itr );
 }
 
 BOOST_AUTO_TEST_CASE( TestPropertyGroupCategory )
 {
- TestPropertyGroup_5 testGroup;
+ property_group testGroup("TEST_GROUP", NULL);
         
         testGroup.add_category( PROPERTY_GROUP_CATEGORY1 );
         testGroup.add_category( PROPERTY_GROUP_CATEGORY2 );
@@ -156,7 +256,6 @@
         BOOST_CHECK( pos == testGroup.get_category_collection().end() );
 }
 
-
 BOOST_AUTO_TEST_CASE( TestSingletonPropertyManager )
 {
         TestPropertyManagerGuard gaurd;
@@ -171,13 +270,13 @@
         TestPropertyManager *p_manager = gaurd.p_manager;
 
         // The first item should parent to root
- TestPropertyChildGroup_1 rootGroup(NULL);
+ TestPropertyChildGroup rootGroup(NULL);
         BOOST_CHECK_EQUAL( p_manager->uiRegisterPropertyGroupCallCount, 1u );
         BOOST_CHECK_EQUAL( p_manager->uiUnRegisterPropertyGroupCallCount, 0u );
         BOOST_CHECK_EQUAL( p_manager->uiChildCount, 1u );
 
         // The second item should parent to the first
- TestPropertyChildGroup_1 childGroup(&rootGroup);
+ TestPropertyChildGroup childGroup(&rootGroup);
         BOOST_CHECK_EQUAL( p_manager->uiRegisterPropertyGroupCallCount, 2u );
         BOOST_CHECK_EQUAL( p_manager->uiUnRegisterPropertyGroupCallCount, 0u );
         BOOST_CHECK_EQUAL( p_manager->uiChildCount, 1u );
@@ -207,13 +306,13 @@
         TestPropertyManager *p_manager = gaurd.p_manager;
 
         // The first item should parent to root
- TestPropertyChildGroup_1 *pRootGroup = new TestPropertyChildGroup_1(NULL);
+ TestPropertyChildGroup *pRootGroup = new TestPropertyChildGroup(NULL);
         BOOST_CHECK_EQUAL( p_manager->uiRegisterPropertyGroupCallCount, 1u );
         BOOST_CHECK_EQUAL( p_manager->uiUnRegisterPropertyGroupCallCount, 0u );
         BOOST_CHECK_EQUAL( p_manager->uiChildCount, 1u );
 
         // The second item should parent to the first
- TestPropertyChildGroup_1 childGroup(pRootGroup);
+ TestPropertyChildGroup childGroup(pRootGroup);
         BOOST_CHECK_EQUAL( p_manager->uiRegisterPropertyGroupCallCount, 2u );
         BOOST_CHECK_EQUAL( p_manager->uiUnRegisterPropertyGroupCallCount, 0u );
         BOOST_CHECK_EQUAL( p_manager->uiChildCount, 1u );
@@ -237,17 +336,20 @@
 // properties in which case this wouldn't be an issue.
 BOOST_AUTO_TEST_CASE( TestNoCopyConstructorProperties )
 {
- TestPropertyGroup_5 testGroup;
- // For this test, TestPropertyGroup_5 shouldn't have a copy constructor
- TestPropertyGroup_5 copiedGroup( testGroup );
+ bool test_bool(false);
 
- BOOST_CHECK_EQUAL( copiedGroup.prop_count(), 0u );
+ // For this test, testGroup shouldn't have a copy constructor
+ property_group testGroup("TEST_GROUP", NULL);
+ testGroup.add_property("Test1", "", BOOST_SETTER_NONE, BOOST_GETTER_VAR(test_bool));
+ testGroup.add_property("Test2", "", BOOST_SETTER_NONE, BOOST_GETTER_VAR(test_bool));
+ BOOST_CHECK_EQUAL( testGroup.prop_count(), 2u );
 
- // This is here, because if this test fails, and we don't clear
- // the properties, and the test app can hang when copiedGroup is destroyed.
- testGroup.clear_properties();
+ property_group copiedGroup( testGroup );
+ BOOST_CHECK_EQUAL( copiedGroup.prop_count(), 0u );
 }
 
+void NullOpFunction(){;}
+
 // This is counter intuitive, but by default, if an object inherits from property_group,
 // adds actions, and that object doesn't have a copy constructor, it is important that
 // the old actions aren't copied over. This is because the property_group object can't
@@ -256,46 +358,45 @@
 // actions in which case this wouldn't be an issue.
 BOOST_AUTO_TEST_CASE( TestNoCopyConstructorActions )
 {
- TestActionsFixture testGroup;
- // For this test, TestActionsFixture shouldn't have a copy constructor
- TestActionsFixture copiedGroup( testGroup );
+ // For this test, testGroup shouldn't have a copy constructor
+ property_group testGroup("TEST_GROUP", NULL);
+ testGroup.add_action("Test1", "", boost::bind(NullOpFunction));
+ testGroup.add_action("Test2", "", boost::bind(NullOpFunction));
+ BOOST_CHECK_EQUAL( testGroup.action_count(), 2u );
 
+ property_group copiedGroup( testGroup );
         BOOST_CHECK_EQUAL( copiedGroup.action_count(), 0u );
-
- // This is here, because if this test fails, and we don't clear
- // the actions, the test app will hang when copiedGroup is destroyed.
- testGroup.clear_actions();
 }
 
 BOOST_AUTO_TEST_CASE( TestCopyConstructor_RootObject )
 {
- TestPropertyGroup_5 testGroup;
- TestPropertyGroup_5 copiedGroup( testGroup );
+ property_group testGroup("TEST_GROUP", NULL);
+ property_group copiedGroup( testGroup );
 
- BOOST_CHECK_EQUAL( copiedGroup.get_name().compare(PROPERTY_GROUP_NAME), 0 );
+ BOOST_CHECK_EQUAL( "TEST_GROUP", copiedGroup.get_name() );
         BOOST_CHECK( NULL == copiedGroup.get_parent() );
-
- // This is here, because if Copy Constructor isn't right, and we don't clear
- // the properties, the test app will hang when copied Group is destroyed.
- testGroup.clear_properties();
 }
 
 BOOST_AUTO_TEST_CASE( TestCopyConstructor_ChildObject )
 {
- TestPropertyGroup_5 testGroup;
- TestPropertyChildGroup_1 group(&testGroup);
- TestPropertyChildGroup_1 copiedGroup(&group);
+ property_group testGroup("TEST_GROUP", NULL);
+ property_group childGroup("TEST_CHILD_GROUP", &testGroup);
+ property_group copiedGroup( testGroup );
 
- BOOST_CHECK_EQUAL( copiedGroup.get_name().compare(PROPERTY_GROUP_CHILD_NAME), 0 );
- BOOST_CHECK( &group == copiedGroup.get_parent() );
+ BOOST_CHECK_EQUAL( copiedGroup.get_name(), "TEST_GROUP" );
+ BOOST_CHECK( NULL == copiedGroup.get_parent() );
 }
 
 BOOST_AUTO_TEST_CASE( TestIsReadOnly )
 {
- TestPropertyGroup testGroup;
+ bool test_bool(false);
+
+ property_group testGroup("TEST_GROUP", NULL);
+ testGroup.add_property("read_only", "", BOOST_SETTER_NONE, BOOST_GETTER_VAR(test_bool));
+ testGroup.add_property("writable", "", BOOST_SETTER_VAR(test_bool), BOOST_GETTER_VAR(test_bool));
         
- BOOST_CHECK_EQUAL( testGroup.is_read_only(PROPERTY_STRING_1), true );
- BOOST_CHECK_EQUAL( testGroup.is_read_only(PROPERTY_FLOAT_1), false );
-}
+ BOOST_CHECK_EQUAL( testGroup.is_read_only("read_only"), true );
+ BOOST_CHECK_EQUAL( testGroup.is_read_only("writable"), false );
 
-// test throw on readonly set
\ No newline at end of file
+ BOOST_CHECK_THROW( testGroup.set("read_only", false), boost::bad_function_call);
+}
\ No newline at end of file

Modified: sandbox/pinhole/libs/pinhole/test/test_string_properties.cpp
==============================================================================
--- sandbox/pinhole/libs/pinhole/test/test_string_properties.cpp (original)
+++ sandbox/pinhole/libs/pinhole/test/test_string_properties.cpp 2007-12-05 18:44:39 EST (Wed, 05 Dec 2007)
@@ -25,19 +25,26 @@
 #endif
         TestGroup() : property_group( "PropertyGroupName", NULL )
         {
- add_property("String_Func", "String1 description", BOOST_SETTER(&TestGroup::SetString), BOOST_GETTER(&TestGroup::GetString), NULL );
- add_property("String_Var", "String2 description", BOOST_SETTER_VAR(m_string_Var), BOOST_GETTER_VAR(m_string_Var), NULL );
+ add_property("String_Func", "String1 description", BOOST_SETTER(&TestGroup::SetString), BOOST_GETTER(&TestGroup::GetString) );
+ add_property("String_Var", "String2 description", BOOST_SETTER_VAR(m_string_Var), BOOST_GETTER_VAR(m_string_Var) );
+ add_property("WString_Func", "Wstring1 description", BOOST_SETTER(&TestGroup::SetWString), BOOST_GETTER(&TestGroup::GetWString) );
+ add_property("WString_Var", "Wstring2 description", BOOST_SETTER_VAR(m_wstring_Var), BOOST_GETTER_VAR(m_wstring_Var) );
         }
 #if defined(BOOST_MSVC)
     #pragma warning(pop)
 #endif
 
         void SetString( string x ){ m_string_Func = x; }
- string GetString(){ return( m_string_Func ); }
+ string GetString(){ return( m_string_Func ); }
+
+ void SetWString( wstring x ){ m_wstring_Func = x; }
+ wstring GetWString(){ return( m_wstring_Func ); }
 
 private:
         string m_string_Func;
- string m_string_Var;
+ string m_string_Var;
+ wstring m_wstring_Func;
+ wstring m_wstring_Var;
 };
 
 BOOST_AUTO_TEST_CASE( TestGetSetString_Func )
@@ -48,18 +55,56 @@
         BOOST_CHECK_EQUAL( testGroup.get<string>("String_Func"), "first" );
     
         testGroup.set_as_string( "String_Func", "second" );
- BOOST_CHECK_EQUAL( testGroup.get_as_string("String_Func"), "second" );
+ BOOST_CHECK_EQUAL( testGroup.get_as_string("String_Func"), "second" );
+
+ BOOST_CHECK_THROW( testGroup.set_as_wstring( "String_Func", L"third" ), std::invalid_argument );
+ BOOST_CHECK_THROW( testGroup.get_as_wstring("String_Func"), std::invalid_argument );
+ BOOST_CHECK_EQUAL( testGroup.get_as_string("String_Func"), "second" );
 }
 
 BOOST_AUTO_TEST_CASE( TestGetSetString_Var )
 {
     TestGroup testGroup;
 
- testGroup.set( "String_Var", string("first") );
- BOOST_CHECK_EQUAL( testGroup.get<string>("String_Var"), "first" );
+ testGroup.set( "WString_Var", wstring(L"first") );
+ BOOST_CHECK( testGroup.get<wstring>("WString_Var") == L"first" );
     
- testGroup.set_as_string( "String_Var", "second" );
- BOOST_CHECK_EQUAL( testGroup.get_as_string("String_Var"), "second" );
+ testGroup.set_as_wstring( "WString_Var", L"second" );
+ BOOST_CHECK( testGroup.get_as_wstring("WString_Var") == L"second" );
+
+ BOOST_CHECK_THROW( testGroup.set_as_string( "WString_Var", "third" ), std::invalid_argument );
+ BOOST_CHECK_THROW( testGroup.get_as_string("WString_Var"), std::invalid_argument );
+ BOOST_CHECK( testGroup.get_as_wstring("WString_Var") == L"second" );
+}
+
+BOOST_AUTO_TEST_CASE( TestGetSetWString_Func )
+{
+ TestGroup testGroup;
+
+ testGroup.set( "WString_Func", wstring(L"first") );
+ BOOST_CHECK( testGroup.get<wstring>("WString_Func") == L"first" );
+
+ testGroup.set_as_wstring( "WString_Func", L"second" );
+ BOOST_CHECK( testGroup.get_as_wstring("WString_Func") == L"second" );
+
+ BOOST_CHECK_THROW( testGroup.set_as_string("WString_Func", "third" ), std::invalid_argument );
+ BOOST_CHECK_THROW( testGroup.get_as_string("WString_Func"), std::invalid_argument );
+ BOOST_CHECK( testGroup.get_as_wstring("WString_Func") == L"second" );
+}
+
+BOOST_AUTO_TEST_CASE( TestGetSetWString_Var )
+{
+ TestGroup testGroup;
+
+ testGroup.set( "String_Var", string("first") );
+ BOOST_CHECK_EQUAL( testGroup.get<string>("String_Var"), "first" );
+
+ testGroup.set_as_string( "String_Var", "second" );
+ BOOST_CHECK_EQUAL( testGroup.get_as_string("String_Var"), "second" );
+
+ BOOST_CHECK_THROW( testGroup.set_as_wstring("String_Var", L"third" ), std::invalid_argument );
+ BOOST_CHECK_THROW( testGroup.get_as_wstring("String_Var"), std::invalid_argument );
+ BOOST_CHECK_EQUAL( testGroup.get_as_string("String_Var"), "second" );
 }
 
 BOOST_AUTO_TEST_CASE( TestStringPropertyType )


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