00001 #ifndef ABSTRACTPROPERTYCONTAINER_H
00002 #define ABSTRACTPROPERTYCONTAINER_H
00003
00004 #include "Types.h"
00005 #include "ContainerProperty.h"
00006
00008
00013 namespace RenderTools {
00014
00015 class AbstractPropertyContainer : public ContainerProperty {
00016 public:
00017
00018 AbstractPropertyContainer( void );
00019 virtual ~AbstractPropertyContainer( void );
00020
00021 virtual void onPropertyEvent( const PropertyEvent & p );
00022 virtual void onPropertyContainerEvent( const PropertyContainerEvent & p );
00023 virtual void createProperties( void );
00024 virtual void setOwner( const PropertyContainerPtr & owner );
00025 virtual const XMLNodePtr toXML( const XMLNodePtr & parent = XMLNodePtr() ) const;
00026 virtual void onInitialize( void );
00027 virtual void initialize( bool force = false );
00028 void sendPropertyContainerEvent( const PropertyContainerEvent & p );
00029 const PropertyList & getProperties( void ) const;
00030 void findPointers( const string name, PropertyList & results );
00031 const PropertyPtr findProperty( const void * ) const;
00032 const PropertyPtr findProperty( const string name ) const;
00033 int findIndex( const string name ) const;
00034 const PropertyPtr getProperty( const string name ) const;
00035 const PropertyPtr getItem( unsigned int i ) const;
00036 const PropertyPtr getProperty( unsigned int i ) const;
00037 void setProperty( const string name, const string value, bool send );
00038 void setProperty( const XMLNodePtr & xml, bool send );
00039 void setProperties( const XMLNodePtr & xml, bool send );
00040 bool isProperty( const PropertyPtr & p ) const;
00041 bool isProperty( const string name ) const;
00042 bool isProperty( const string name, const string value ) const;
00043 bool removeProperty( const PropertyPtr & p, bool send );
00044 bool removeProperty( unsigned int index, bool send );
00045 bool removeProperties( unsigned int first, unsigned int last, bool send );
00046 bool removeProperties( bool send = false );
00047 virtual const PropertyPtr addProperty( const string name, bool send );
00048 virtual const PropertyPtr addProperty( const PropertyPtr & p, bool send );
00049 virtual void setName( const XMLNodePtr & xml = XMLNodePtr() );
00050 virtual void setName( const string name );
00051 virtual void recalculatePath( void );
00052 void propertyChanged( const PropertyPtr & p );
00053 void propertyAdded( const PropertyPtr & p );
00054 void propertyRemoved( const PropertyPtr & p );
00055 unsigned int size( void ) const;
00056 const PropertyPtr operator [] ( int ) const;
00057 PropertyPtr operator [] ( int );
00058 static void extractVariables( const XMLNodePtr & xml );
00059 static void addVariable( const string key, const string value );
00060 static const string interpret( const string value );
00061 static void addPropertyToOwner( AbstractPropertyContainer * owner, const PropertyPtr p );
00062 static void removePropertyFromOwner( AbstractPropertyContainer * owner, const PropertyPtr p );
00063
00064 friend ostream & operator << ( ostream & os, const AbstractPropertyContainer & rhs );
00065 friend const istream & operator >> ( const istream & is, AbstractPropertyContainer & rhs );
00066
00067 protected:
00068 PropertyList m_properties;
00069 static map< string, string > s_variables;
00070
00071 };
00072
00073 };
00074
00075
00076 #endif