Type: info
         Title: comphelper/property.hxx
     Posted by: [EMAIL PROTECTED]
      Affected: comphelper
Effective from: cws_src680_picom


*Summary*
--------
+struct PropertyStringEqualFunctor;
+struct PropertyEqualByName;
+bool findProperty(Property& o_rProp, Sequence<Property>& i_seqProps, const 
OUString& i_rPropName);

*Description*
-------------
namespace comphelper
{
/** find property with given name

    @param o_rProp
    Output parameter receiving the property, if found

    @param i_rPropName
    Name of the property to find

    @return false, if property was not found
 */
bool findProperty(starbeans::Property& o_rProp,
staruno::Sequence<starbeans::Property>& i_seqProps, const
::rtl::OUString& i_rPropName);
}

In fact, the implementation is a nice example of how to employ
boost::bind to glue together existing functionality:

namespace comphelper
{

bool findProperty(
                  Property&              o_rProp, 
                  Sequence<Property>&    i_seqProps, 
                  const ::rtl::OUString& i_rPropName)
{
    const Property* pAry(i_seqProps.getConstArray());
    const sal_Int32 nLen(i_seqProps.getLength());
    const Property* pRes(
        std::find_if(pAry,pAry+nLen,
                     boost::bind(PropertyStringEqualFunctor(),
                                 _1,
                                 boost::cref(i_rPropName))));
    if( pRes == pAry+nLen )
        return false;

    o_rProp = *pRes;
    return true;
}

}


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to