Tag: cws_src680_qiq User: fs Date: 2006/06/27 08:12:22 Modified: dba/connectivity/source/sdbcx/VDescriptor.cxx
Log: RESYNC: (1.4-1.5); FILE MERGED File Changes: Directory: /dba/connectivity/source/sdbcx/ ========================================== File [changed]: VDescriptor.cxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/sdbcx/VDescriptor.cxx?r1=1.4.104.1&r2=1.4.104.2 Delta lines: +59 -9 -------------------- --- VDescriptor.cxx 16 Jun 2006 11:32:40 -0000 1.4.104.1 +++ VDescriptor.cxx 27 Jun 2006 15:12:20 -0000 1.4.104.2 @@ -40,6 +40,9 @@ #include <cppuhelper/queryinterface.hxx> #endif +#include <functional> +#include <algorithm> + namespace connectivity { namespace sdbcx @@ -54,8 +57,8 @@ // ------------------------------------------------------------------------- ODescriptor::ODescriptor(::cppu::OBroadcastHelper& _rBHelper,sal_Bool _bCase, sal_Bool _bNew) :ODescriptor_PBASE(_rBHelper) - ,m_bNew(_bNew) ,m_aCase(_bCase) + ,m_bNew(_bNew) { } @@ -64,10 +67,57 @@ sal_Int64 SAL_CALL ODescriptor::getSomething( const Sequence< sal_Int8 >& rId ) throw(RuntimeException) { return (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) - ? - (sal_Int64)this - : - 0; + ? reinterpret_cast< sal_Int64 >( this ) + : 0; + } + + // ----------------------------------------------------------------------------- + ODescriptor* ODescriptor::getImplementation( const Reference< XInterface >& _rxSomeComp ) + { + Reference< XUnoTunnel > xTunnel( _rxSomeComp, UNO_QUERY ); + if ( xTunnel.is() ) + return reinterpret_cast< ODescriptor* >( xTunnel->getSomething( getUnoTunnelImplementationId() ) ); + return NULL; + } + + // ----------------------------------------------------------------------------- + namespace + { + struct ResetROAttribute : public ::std::unary_function< Property, void > + { + void operator ()( Property& _rProperty ) const + { + _rProperty.Attributes &= ~PropertyAttribute::READONLY; + } + }; + struct SetROAttribute : public ::std::unary_function< Property, void > + { + void operator ()( Property& _rProperty ) const + { + _rProperty.Attributes |= PropertyAttribute::READONLY; + } + }; + } + + // ----------------------------------------------------------------------------- + ::cppu::IPropertyArrayHelper* ODescriptor::doCreateArrayHelper() const + { + Sequence< Property > aProperties; + describeProperties( aProperties ); + + if ( isNew() ) + ::std::for_each( aProperties.getArray(), aProperties.getArray() + aProperties.getLength(), ResetROAttribute() ); + else + ::std::for_each( aProperties.getArray(), aProperties.getArray() + aProperties.getLength(), SetROAttribute() ); + + return new ::cppu::OPropertyArrayHelper( aProperties ); + } + + // ----------------------------------------------------------------------------- + sal_Bool ODescriptor::isNew( const Reference< XInterface >& _rxDescriptor ) + { + ODescriptor* pImplementation = getImplementation( _rxDescriptor ); + return pImplementation != NULL ? pImplementation->isNew() : sal_False; } // ----------------------------------------------------------------------------- --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
