summaryrefslogtreecommitdiff
path: root/connectivity/source/sdbcx/VDescriptor.cxx
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2006-06-20 01:10:13 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2006-06-20 01:10:13 +0000
commitd26d4975fe1d319f8caccd9e66a1744f849e5ffd (patch)
tree8235d91595672203c949b8739f0edc52021f0729 /connectivity/source/sdbcx/VDescriptor.cxx
parent807adb31bc412cb806c33dee4c9195b3d47be831 (diff)
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
Diffstat (limited to 'connectivity/source/sdbcx/VDescriptor.cxx')
-rw-r--r--connectivity/source/sdbcx/VDescriptor.cxx64
1 files changed, 57 insertions, 7 deletions
diff --git a/connectivity/source/sdbcx/VDescriptor.cxx b/connectivity/source/sdbcx/VDescriptor.cxx
index 0ca88646933d..a5ce63872907 100644
--- a/connectivity/source/sdbcx/VDescriptor.cxx
+++ b/connectivity/source/sdbcx/VDescriptor.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: VDescriptor.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: rt $ $Date: 2005-09-08 07:43:09 $
+ * last change: $Author: hr $ $Date: 2006-06-20 02:10:13 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -40,6 +40,9 @@
#include <cppuhelper/queryinterface.hxx>
#endif
+#include <functional>
+#include <algorithm>
+
namespace connectivity
{
namespace sdbcx
@@ -54,8 +57,8 @@ namespace connectivity
// -------------------------------------------------------------------------
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 @@ namespace connectivity
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;
}
// -----------------------------------------------------------------------------