User: hr Date: 06/06/19 19:10:15 Modified: /dba/connectivity/source/sdbcx/ VDescriptor.cxx
Log: INTEGRATION: CWS warnings01 (1.4.30); FILE MERGED 2006/06/14 10:56:24 fs 1.4.30.2: #i66367# reverted previous changes related to replacing IdPropertyArrayHelper with PropertyArrayHelper - there's a subtle difference between both ids ... 2005/11/07 14:44:16 fs 1.4.30.1: #i57457# warning-free code 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&r2=1.5 Delta lines: +56 -6 -------------------- --- VDescriptor.cxx 8 Sep 2005 07:43:09 -0000 1.4 +++ VDescriptor.cxx 20 Jun 2006 02:10:13 -0000 1.5 @@ -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]
