TuttleOFX  1
TuttleOFX/libraries/tuttle/src/tuttle/host/ofx/attribute/OfxhAttributeAccessor.hpp
Go to the documentation of this file.
00001 #ifndef _TUTTLE_HOST_OFX_ATTRIBUTE_ATTRIBUTEACCESSOR_HPP_
00002 #define _TUTTLE_HOST_OFX_ATTRIBUTE_ATTRIBUTEACCESSOR_HPP_
00003 
00004 #include <tuttle/host/ofx/property/OfxhSet.hpp>
00005 
00006 #include <ofxCore.h>
00007 #include <ofxAttribute.h>
00008 
00009 #include <string>
00010 
00011 namespace tuttle {
00012 namespace host {
00013 namespace ofx {
00014 namespace attribute {
00015 
00016 class OfxhAttributeAccessor
00017 {
00018 public:
00019         OfxhAttributeAccessor();
00020         //      explicit Base( const Base& ); // auto
00021         virtual ~OfxhAttributeAccessor() = 0;
00022 
00023 protected:
00024         virtual void setProperties( const property::OfxhSet& properties ) = 0;
00025 
00026 public:
00027         virtual const property::OfxhSet& getProperties() const   = 0;
00028         virtual property::OfxhSet&       getEditableProperties() = 0;
00029 
00030 public:
00031         /// is the clip an output clip
00032 
00033         bool isOutput() const
00034         {
00035                 return getName() == kOfxOutputAttributeName;
00036         }
00037 
00038         void setAllNames( const std::string& name )
00039         {
00040                 setName( name );
00041                 setLabel( name );
00042                 setShortLabel( name );
00043                 setLongLabel( name );
00044         }
00045 
00046         const std::string& getAttributeType() const
00047         {
00048                 return getProperties().getStringProperty( kOfxPropType );
00049         }
00050 
00051         const std::string& getName() const
00052         {
00053                 return getProperties().getStringProperty( kOfxPropName );
00054         }
00055 
00056         void setName( const std::string& name )
00057         {
00058                 return getEditableProperties().setStringProperty( kOfxPropName, name );
00059         }
00060 
00061         /** name of the clip
00062          */
00063         const std::string& getShortLabel() const
00064         {
00065                 const std::string& s = getProperties().getStringProperty( kOfxPropShortLabel );
00066 
00067                 if( s == "" )
00068                 {
00069                         return getLabel();
00070                 }
00071                 return s;
00072         }
00073 
00074         void setShortLabel( const std::string& label )
00075         {
00076                 return getEditableProperties().setStringProperty( kOfxPropShortLabel, label );
00077         }
00078 
00079         /** name of the clip
00080          */
00081         const std::string& getLabel() const
00082         {
00083                 const std::string& s = getProperties().getStringProperty( kOfxPropLabel );
00084 
00085                 if( s == "" )
00086                 {
00087                         return getName();
00088                 }
00089                 return s;
00090         }
00091 
00092         void setLabel( const std::string& label )
00093         {
00094                 return getEditableProperties().setStringProperty( kOfxPropLabel, label );
00095         }
00096 
00097         /** name of the clip
00098          */
00099         const std::string& getLongLabel() const
00100         {
00101                 const std::string& s = getProperties().getStringProperty( kOfxPropLongLabel );
00102 
00103                 if( s == "" )
00104                 {
00105                         return getLabel();
00106                 }
00107                 return s;
00108         }
00109 
00110         void setLongLabel( const std::string& label )
00111         {
00112                 return getEditableProperties().setStringProperty( kOfxPropLongLabel, label );
00113         }
00114 
00115         /** get a handle on the properties of the clip descriptor for the C api
00116          */
00117         OfxPropertySetHandle getPropHandle() const
00118         {
00119                 return getProperties().getHandle();
00120         }
00121 
00122 };
00123 
00124 }
00125 }
00126 }
00127 }
00128 
00129 #endif
00130