LCOV - code coverage report
Current view: top level - libreoffice/solver/unxlngi6.pro/inc/ucbhelper - propertyvalueset.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 3 18 16.7 %
Date: 2012-12-27 Functions: 1 6 16.7 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef _UCBHELPER_PROPERTYVALUESET_HXX
      21             : #define _UCBHELPER_PROPERTYVALUESET_HXX
      22             : 
      23             : #include <com/sun/star/lang/XTypeProvider.hpp>
      24             : #include <com/sun/star/sdbc/XColumnLocate.hpp>
      25             : #include <com/sun/star/sdbc/XRow.hpp>
      26             : #include <com/sun/star/beans/Property.hpp>
      27             : #include <cppuhelper/weak.hxx>
      28             : 
      29             : #include "osl/mutex.hxx"
      30             : #include <ucbhelper/macros.hxx>
      31             : #include "ucbhelper/ucbhelperdllapi.h"
      32             : 
      33             : namespace com { namespace sun { namespace star { namespace script {
      34             :     class XTypeConverter;
      35             : } } } }
      36             : 
      37             : namespace com { namespace sun { namespace star { namespace beans {
      38             :     struct PropertyValue;
      39             :     class XPropertySet;
      40             : } } } }
      41             : 
      42             : namespace ucbhelper {
      43             : 
      44             : class PropertyValues;
      45             : 
      46             : //=========================================================================
      47             : 
      48             : /**
      49             :   * This class implements the interface XRow. After construction of a valueset
      50             :   * the user can append properties ( incl. its values ) to the set. This class
      51             :   * is useful when implementing the command "getPropertyValues", because the
      52             :   * values to return can easyly appended to a valueset object. That object can
      53             :   * directly be returned by the implementation of the command.
      54             :   */
      55             : class UCBHELPER_DLLPUBLIC PropertyValueSet :
      56             :                 public cppu::OWeakObject,
      57             :                 public com::sun::star::lang::XTypeProvider,
      58             :                 public com::sun::star::sdbc::XRow,
      59             :                 public com::sun::star::sdbc::XColumnLocate
      60             : {
      61             :     com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
      62             :                                      m_xContext;
      63             :     com::sun::star::uno::Reference< com::sun::star::script::XTypeConverter >
      64             :                                      m_xTypeConverter;
      65             :     osl::Mutex      m_aMutex;
      66             :     PropertyValues* m_pValues;
      67             :     sal_Bool        m_bWasNull;
      68             :     sal_Bool        m_bTriedToGetTypeConverter;
      69             : 
      70             : private:
      71             :     UCBHELPER_DLLPRIVATE const com::sun::star::uno::Reference<
      72             :             com::sun::star::script::XTypeConverter >&
      73             :     getTypeConverter();
      74             : 
      75             : public:
      76             :     PropertyValueSet(
      77             :             const com::sun::star::uno::Reference<
      78             :                 com::sun::star::uno::XComponentContext >& rxContext );
      79             :     virtual ~PropertyValueSet();
      80             : 
      81             :     // XInterface
      82             :     XINTERFACE_DECL()
      83             : 
      84             :     // XTypeProvider
      85             :     XTYPEPROVIDER_DECL()
      86             : 
      87             :     // XRow
      88             :     virtual sal_Bool SAL_CALL
      89             :     wasNull()
      90             :         throw( ::com::sun::star::sdbc::SQLException,
      91             :                ::com::sun::star::uno::RuntimeException );
      92             :     virtual ::rtl::OUString SAL_CALL
      93             :     getString( sal_Int32 columnIndex )
      94             :         throw( ::com::sun::star::sdbc::SQLException,
      95             :                ::com::sun::star::uno::RuntimeException );
      96             :     virtual sal_Bool SAL_CALL
      97             :     getBoolean( sal_Int32 columnIndex )
      98             :         throw( ::com::sun::star::sdbc::SQLException,
      99             :                ::com::sun::star::uno::RuntimeException );
     100             :     virtual sal_Int8 SAL_CALL
     101             :     getByte( sal_Int32 columnIndex )
     102             :         throw( ::com::sun::star::sdbc::SQLException,
     103             :                ::com::sun::star::uno::RuntimeException );
     104             :     virtual sal_Int16 SAL_CALL
     105             :     getShort( sal_Int32 columnIndex )
     106             :         throw( ::com::sun::star::sdbc::SQLException,
     107             :                ::com::sun::star::uno::RuntimeException );
     108             :     virtual sal_Int32 SAL_CALL
     109             :     getInt( sal_Int32 columnIndex )
     110             :         throw( ::com::sun::star::sdbc::SQLException,
     111             :                ::com::sun::star::uno::RuntimeException );
     112             :     virtual sal_Int64 SAL_CALL
     113             :     getLong( sal_Int32 columnIndex )
     114             :         throw( ::com::sun::star::sdbc::SQLException,
     115             :                ::com::sun::star::uno::RuntimeException );
     116             :     virtual float SAL_CALL
     117             :     getFloat( sal_Int32 columnIndex )
     118             :         throw( ::com::sun::star::sdbc::SQLException,
     119             :                ::com::sun::star::uno::RuntimeException );
     120             :     virtual double SAL_CALL
     121             :     getDouble( sal_Int32 columnIndex )
     122             :         throw( ::com::sun::star::sdbc::SQLException,
     123             :                ::com::sun::star::uno::RuntimeException );
     124             :     virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
     125             :     getBytes( sal_Int32 columnIndex )
     126             :         throw( ::com::sun::star::sdbc::SQLException,
     127             :                ::com::sun::star::uno::RuntimeException );
     128             :     virtual ::com::sun::star::util::Date SAL_CALL
     129             :     getDate( sal_Int32 columnIndex )
     130             :         throw( ::com::sun::star::sdbc::SQLException,
     131             :                ::com::sun::star::uno::RuntimeException );
     132             :     virtual ::com::sun::star::util::Time SAL_CALL
     133             :     getTime( sal_Int32 columnIndex )
     134             :         throw( ::com::sun::star::sdbc::SQLException,
     135             :                ::com::sun::star::uno::RuntimeException );
     136             :     virtual ::com::sun::star::util::DateTime SAL_CALL
     137             :     getTimestamp( sal_Int32 columnIndex )
     138             :         throw( ::com::sun::star::sdbc::SQLException,
     139             :                ::com::sun::star::uno::RuntimeException );
     140             :     virtual ::com::sun::star::uno::Reference<
     141             :                 ::com::sun::star::io::XInputStream > SAL_CALL
     142             :     getBinaryStream( sal_Int32 columnIndex )
     143             :         throw( ::com::sun::star::sdbc::SQLException,
     144             :                ::com::sun::star::uno::RuntimeException );
     145             :     virtual ::com::sun::star::uno::Reference<
     146             :                 ::com::sun::star::io::XInputStream > SAL_CALL
     147             :     getCharacterStream( sal_Int32 columnIndex )
     148             :         throw( ::com::sun::star::sdbc::SQLException,
     149             :                ::com::sun::star::uno::RuntimeException );
     150             :     virtual ::com::sun::star::uno::Any SAL_CALL
     151             :     getObject( sal_Int32 columnIndex,
     152             :                const ::com::sun::star::uno::Reference<
     153             :                    ::com::sun::star::container::XNameAccess >& typeMap )
     154             :         throw( ::com::sun::star::sdbc::SQLException,
     155             :                ::com::sun::star::uno::RuntimeException );
     156             :     virtual ::com::sun::star::uno::Reference<
     157             :                 ::com::sun::star::sdbc::XRef > SAL_CALL
     158             :     getRef( sal_Int32 columnIndex )
     159             :         throw( ::com::sun::star::sdbc::SQLException,
     160             :                ::com::sun::star::uno::RuntimeException );
     161             :     virtual ::com::sun::star::uno::Reference<
     162             :                 ::com::sun::star::sdbc::XBlob > SAL_CALL
     163             :     getBlob( sal_Int32 columnIndex )
     164             :         throw( ::com::sun::star::sdbc::SQLException,
     165             :                ::com::sun::star::uno::RuntimeException );
     166             :     virtual ::com::sun::star::uno::Reference<
     167             :                 ::com::sun::star::sdbc::XClob > SAL_CALL
     168             :     getClob( sal_Int32 columnIndex )
     169             :         throw( ::com::sun::star::sdbc::SQLException,
     170             :                ::com::sun::star::uno::RuntimeException );
     171             :     virtual ::com::sun::star::uno::Reference<
     172             :                 ::com::sun::star::sdbc::XArray > SAL_CALL
     173             :     getArray( sal_Int32 columnIndex )
     174             :         throw( ::com::sun::star::sdbc::SQLException,
     175             :                ::com::sun::star::uno::RuntimeException );
     176             : 
     177             :     // XColumnLocate
     178             :     virtual sal_Int32 SAL_CALL
     179             :     findColumn( const ::rtl::OUString& columnName )
     180             :         throw( ::com::sun::star::sdbc::SQLException,
     181             :                ::com::sun::star::uno::RuntimeException );
     182             : 
     183             :     //////////////////////////////////////////////////////////////////////
     184             :     // Non-interface methods
     185             :     //////////////////////////////////////////////////////////////////////
     186             : 
     187             :     void appendString( const ::rtl::OUString& rPropName, const ::rtl::OUString& rValue );
     188             :     void appendString( const sal_Char* pAsciiPropName, const ::rtl::OUString& rValue )
     189             :     {
     190             :         appendString( ::rtl::OUString::createFromAscii( pAsciiPropName ), rValue );
     191             :     }
     192           0 :     void appendString( const ::com::sun::star::beans::Property& rProp, const ::rtl::OUString& rValue )
     193             :     {
     194           0 :         appendString( rProp.Name, rValue );
     195           0 :     }
     196             : 
     197             :     void appendBoolean( const ::rtl::OUString& rPropName, sal_Bool bValue );
     198             :     void appendBoolean( const sal_Char* pAsciiPropName, sal_Bool bValue )
     199             :     {
     200             :         appendBoolean( ::rtl::OUString::createFromAscii( pAsciiPropName ), bValue );
     201             :     }
     202           0 :     void appendBoolean( const ::com::sun::star::beans::Property& rProp, sal_Bool bValue )
     203             :     {
     204           0 :         appendBoolean( rProp.Name, bValue );
     205           0 :     }
     206             : 
     207             :     void appendLong( const ::rtl::OUString& rPropName, sal_Int64 nValue );
     208             :     void appendLong( const sal_Char* pAsciiPropName, sal_Int64 nValue )
     209             :     {
     210             :         appendLong( ::rtl::OUString::createFromAscii( pAsciiPropName ), nValue );
     211             :     }
     212           0 :     void appendLong( const ::com::sun::star::beans::Property& rProp, sal_Int64 nValue )
     213             :     {
     214           0 :         appendLong( rProp.Name, nValue );
     215           0 :     }
     216             : 
     217             :     void appendTimestamp( const ::rtl::OUString& rPropName, const ::com::sun::star::util::DateTime& rValue );
     218             :     void appendTimestamp( const sal_Char* pAsciiPropName, const ::com::sun::star::util::DateTime& rValue )
     219             :     {
     220             :         appendTimestamp( ::rtl::OUString::createFromAscii( pAsciiPropName ), rValue );
     221             :     }
     222           0 :     void appendTimestamp( const ::com::sun::star::beans::Property& rProp, const ::com::sun::star::util::DateTime& rValue )
     223             :     {
     224           0 :         appendTimestamp( rProp.Name, rValue );
     225           0 :     }
     226             : 
     227             :     void appendObject( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Any& rValue );
     228             :     void appendObject( const sal_Char* pAsciiPropName, const ::com::sun::star::uno::Any& rValue )
     229             :     {
     230             :         appendObject( ::rtl::OUString::createFromAscii( pAsciiPropName ), rValue );
     231             :     }
     232           3 :     void appendObject( const ::com::sun::star::beans::Property& rProp, const ::com::sun::star::uno::Any& rValue )
     233             :     {
     234           3 :         appendObject( rProp.Name, rValue );
     235           3 :     }
     236             : 
     237             :     void appendVoid( const ::rtl::OUString& rPropName );
     238             :     void appendVoid( const sal_Char* pAsciiPropName)
     239             :     {
     240             :         appendVoid( ::rtl::OUString::createFromAscii( pAsciiPropName ) );
     241             :     }
     242           0 :     void appendVoid( const ::com::sun::star::beans::Property& rProp )
     243             :     {
     244           0 :         appendVoid( rProp.Name );
     245           0 :     }
     246             : 
     247             :     /**
     248             :       * This method tries to append all property values contained in a
     249             :       * property set to the value set.
     250             :       *
     251             :        *    @param  rSet is a property set containing the property values.
     252             :       */
     253             :     void appendPropertySet( const ::com::sun::star::uno::Reference<
     254             :                                 ::com::sun::star::beans::XPropertySet >& rSet );
     255             : 
     256             :     /** This method tries to append a single property value contained in a
     257             :       * property set to the value set.
     258             :       *
     259             :        *    @param  rSet is a property set containing the property values.
     260             :        *    @param  rProperty is the property for that the value shall be obtained
     261             :       *         from the given property set.
     262             :        *    @return False, if the property value cannot be obtained from the
     263             :       *         given property pet. True, otherwise.
     264             :        */
     265             :     sal_Bool appendPropertySetValue(
     266             :                         const ::com::sun::star::uno::Reference<
     267             :                             ::com::sun::star::beans::XPropertySet >& rSet,
     268             :                         const ::com::sun::star::beans::Property& rProperty );
     269             : };
     270             : 
     271             : }
     272             : 
     273             : #endif /* !_UCBHELPER_PROPERTYVALUESET_HXX */
     274             : 
     275             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10