LibreOffice Module comphelper (master)  1
Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
comphelper::OPropertyContainerHelper Class Reference

helper class for managing property values, and implementing most of the X*Property* interfaces More...

#include <propertycontainerhelper.hxx>

Inheritance diagram for comphelper::OPropertyContainerHelper:
[legend]

Protected Member Functions

 OPropertyContainerHelper ()
 
 ~OPropertyContainerHelper ()
 
void registerProperty (const OUString &_rName, sal_Int32 _nHandle, sal_Int32 _nAttributes, void *_pPointerToMember, const css::uno::Type &_rMemberType)
 register a property. More...
 
void registerMayBeVoidProperty (const OUString &_rName, sal_Int32 _nHandle, sal_Int32 _nAttributes, css::uno::Any *_pPointerToMember, const css::uno::Type &_rExpectedType)
 register a property. More...
 
void registerPropertyNoMember (const OUString &_rName, sal_Int32 _nHandle, sal_Int32 _nAttributes, const css::uno::Type &_rType, css::uno::Any const &_pInitialValue)
 register a property. More...
 
void revokeProperty (sal_Int32 _nHandle)
 revokes a previously registered property More...
 
bool isRegisteredProperty (sal_Int32 _nHandle) const
 checks whether a property with the given handle has been registered More...
 
bool isRegisteredProperty (const OUString &_rName) const
 checks whether a property with the given name has been registered More...
 
bool convertFastPropertyValue (css::uno::Any &rConvertedValue, css::uno::Any &rOldValue, sal_Int32 nHandle, const css::uno::Any &rValue)
 
void setFastPropertyValue (sal_Int32 nHandle, const css::uno::Any &rValue)
 
void getFastPropertyValue (css::uno::Any &rValue, sal_Int32 nHandle) const
 
void describeProperties (css::uno::Sequence< css::beans::Property > &_rProps) const
 appends the descriptions of all properties which were registered 'til that moment to the given sequence, keeping the array sorted (by name) the given sequence is already sorted by name More...
 
const css::beans::Property & getProperty (const OUString &_rName) const
 retrieves the description for a registered property More...
 

Private Types

typedef ::std::vector< css::uno::Any > PropertyContainer
 
typedef ::std::vector< PropertyDescriptionProperties
 
typedef Properties::iterator PropertiesIterator
 
typedef Properties::const_iterator ConstPropertiesIterator
 

Private Member Functions

COMPHELPER_DLLPRIVATE void implPushBackProperty (const PropertyDescription &_rProp)
 insertion of _rProp into m_aProperties, keeping the sort order More...
 
COMPHELPER_DLLPRIVATE PropertiesIterator searchHandle (sal_Int32 _nHandle)
 search the PropertyDescription for the given handle (within m_aProperties) More...
 
 OPropertyContainerHelper (const OPropertyContainerHelper &)=delete
 
OPropertyContainerHelperoperator= (const OPropertyContainerHelper &)=delete
 

Private Attributes

PropertyContainer m_aHoldProperties
 
Properties m_aProperties
 

Detailed Description

helper class for managing property values, and implementing most of the X*Property* interfaces

The property values are usually held in derived classes, but can also be given to the responsibility of this class here.

For more information, see http://wiki.openoffice.org/wiki/Development/Cpp/Helper/PropertyContainerHelper.

Definition at line 72 of file propertycontainerhelper.hxx.

Member Typedef Documentation

typedef Properties::const_iterator comphelper::OPropertyContainerHelper::ConstPropertiesIterator
private

Definition at line 81 of file propertycontainerhelper.hxx.

Definition at line 79 of file propertycontainerhelper.hxx.

typedef Properties::iterator comphelper::OPropertyContainerHelper::PropertiesIterator
private

Definition at line 80 of file propertycontainerhelper.hxx.

typedef ::std::vector< css::uno::Any > comphelper::OPropertyContainerHelper::PropertyContainer
private

Definition at line 74 of file propertycontainerhelper.hxx.

Constructor & Destructor Documentation

comphelper::OPropertyContainerHelper::OPropertyContainerHelper ( )
protected

Definition at line 63 of file propertycontainerhelper.cxx.

comphelper::OPropertyContainerHelper::~OPropertyContainerHelper ( )
protected

Definition at line 68 of file propertycontainerhelper.cxx.

comphelper::OPropertyContainerHelper::OPropertyContainerHelper ( const OPropertyContainerHelper )
privatedelete

Member Function Documentation

bool comphelper::OPropertyContainerHelper::convertFastPropertyValue ( css::uno::Any &  rConvertedValue,
css::uno::Any &  rOldValue,
sal_Int32  nHandle,
const css::uno::Any &  rValue 
)
protected
void comphelper::OPropertyContainerHelper::describeProperties ( css::uno::Sequence< css::beans::Property > &  _rProps) const
protected

appends the descriptions of all properties which were registered 'til that moment to the given sequence, keeping the array sorted (by name) the given sequence is already sorted by name

Parameters
_rPropsinitial property sequence which is to be extended

Definition at line 457 of file propertycontainerhelper.cxx.

References m_aProperties, and Property.

Referenced by comphelper::PropertyBag::describeProperties().

void comphelper::OPropertyContainerHelper::getFastPropertyValue ( css::uno::Any &  rValue,
sal_Int32  nHandle 
) const
protected
const Property & comphelper::OPropertyContainerHelper::getProperty ( const OUString &  _rName) const
protected

retrieves the description for a registered property

Exceptions
css::beans::UnknownPropertyExceptionif no property with the given name is registered

Definition at line 443 of file propertycontainerhelper.cxx.

References m_aProperties, and Property.

Referenced by comphelper::PropertyBag::removeProperty().

void comphelper::OPropertyContainerHelper::implPushBackProperty ( const PropertyDescription _rProp)
private

insertion of _rProp into m_aProperties, keeping the sort order

Definition at line 176 of file propertycontainerhelper.cxx.

References comphelper::PropertyDescription::aProperty, and m_aProperties.

Referenced by registerMayBeVoidProperty(), registerProperty(), and registerPropertyNoMember().

bool comphelper::OPropertyContainerHelper::isRegisteredProperty ( sal_Int32  _nHandle) const
protected

checks whether a property with the given handle has been registered

Definition at line 143 of file propertycontainerhelper.cxx.

References m_aProperties, and searchHandle().

bool comphelper::OPropertyContainerHelper::isRegisteredProperty ( const OUString &  _rName) const
protected

checks whether a property with the given name has been registered

Definition at line 149 of file propertycontainerhelper.cxx.

References m_aProperties.

OPropertyContainerHelper& comphelper::OPropertyContainerHelper::operator= ( const OPropertyContainerHelper )
privatedelete
void comphelper::OPropertyContainerHelper::registerMayBeVoidProperty ( const OUString &  _rName,
sal_Int32  _nHandle,
sal_Int32  _nAttributes,
css::uno::Any *  _pPointerToMember,
const css::uno::Type &  _rExpectedType 
)
protected

register a property.

The property is represented through a css::uno::Any member of the derived class which calls this methdod.

Parameters
_rNamethe name of the property
_nHandlethe handle of the property
_nAttributesthe attributes of the property
_pPointerToMemberthe pointer to the member representing the property within the derived class, which has to be a css::uno::Any.
_rExpectedTypethe expected type of the property. NOT the type of the object to which _pPointerToMember points (this is always an Any).

Definition at line 101 of file propertycontainerhelper.cxx.

References comphelper::PropertyDescription::aLocation, comphelper::PropertyDescription::aProperty, comphelper::PropertyDescription::DerivedClassAnyType, comphelper::PropertyDescription::eLocated, implPushBackProperty(), comphelper::PropertyDescription::LocationAccess::pDerivedClassMember, and Property.

void comphelper::OPropertyContainerHelper::registerProperty ( const OUString &  _rName,
sal_Int32  _nHandle,
sal_Int32  _nAttributes,
void _pPointerToMember,
const css::uno::Type &  _rMemberType 
)
protected

register a property.

The property is represented through a member of the derived class which calls this methdod.

Parameters
_rNamethe name of the property
_nHandlethe handle of the property
_nAttributesthe attributes of the property
_pPointerToMemberthe pointer to the member representing the property within the derived class.
_rMemberTypethe cppu type of the property represented by the object to which _pPointerToMember points.

Definition at line 73 of file propertycontainerhelper.cxx.

References comphelper::PropertyDescription::aLocation, comphelper::PropertyDescription::aProperty, comphelper::PropertyDescription::DerivedClassRealType, comphelper::PropertyDescription::eLocated, implPushBackProperty(), comphelper::PropertyDescription::LocationAccess::pDerivedClassMember, and Property.

void comphelper::OPropertyContainerHelper::registerPropertyNoMember ( const OUString &  _rName,
sal_Int32  _nHandle,
sal_Int32  _nAttributes,
const css::uno::Type &  _rType,
css::uno::Any const &  _pInitialValue 
)
protected

register a property.

The repository will create an own object holding this property, so there is no need to declare an extra member in your derived class

Parameters
_rNamethe name of the property
_nHandlethe handle of the property
_nAttributesthe attributes of the property
_rTypethe type of the property
_pInitialValuethe initial value of the property. May be void if _nAttributes includes the css::beans::PropertyAttribute::MAYBEVOID flag. Else it must contain a value compatible with the type described by _rType.

Definition at line 122 of file propertycontainerhelper.cxx.

References comphelper::PropertyDescription::aLocation, comphelper::PropertyDescription::aProperty, comphelper::PropertyDescription::eLocated, comphelper::PropertyDescription::HoldMyself, implPushBackProperty(), m_aHoldProperties, comphelper::PropertyDescription::LocationAccess::nOwnClassVectorIndex, and Property.

Referenced by comphelper::PropertyBag::addProperty(), and comphelper::PropertyBag::addVoidProperty().

void comphelper::OPropertyContainerHelper::revokeProperty ( sal_Int32  _nHandle)
protected

revokes a previously registered property

Exceptions
css::beans::UnknownPropertyExceptionif no property with the given handle is registered

Definition at line 92 of file propertycontainerhelper.cxx.

References m_aProperties, and searchHandle().

Referenced by comphelper::PropertyBag::removeProperty().

OPropertyContainerHelper::PropertiesIterator comphelper::OPropertyContainerHelper::searchHandle ( sal_Int32  _nHandle)
private
void comphelper::OPropertyContainerHelper::setFastPropertyValue ( sal_Int32  nHandle,
const css::uno::Any &  rValue 
)
protected

Member Data Documentation

PropertyContainer comphelper::OPropertyContainerHelper::m_aHoldProperties
private
Properties comphelper::OPropertyContainerHelper::m_aProperties
private

The documentation for this class was generated from the following files: