Tag: cws_src680_oj14 User: fs Date: 2007-06-04 20:29:13+0000 Log: some refactoring
File Changes: Directory: /dba/connectivity/inc/connectivity/ ============================================== File [changed]: paramwrapper.hxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/inc/connectivity/paramwrapper.hxx?r1=1.1.2.2&r2=1.1.2.3 Delta lines: +57 -11 --------------------- --- paramwrapper.hxx 2007-06-04 13:19:29+0000 1.1.2.2 +++ paramwrapper.hxx 2007-06-04 20:29:10+0000 1.1.2.3 @@ -4,9 +4,9 @@ * * $RCSfile: paramwrapper.hxx,v $ * - * $Revision: 1.1.2.2 $ + * $Revision: 1.1.2.3 $ * - * last change: $Author: fs $ $Date: 2007/06/04 13:19:29 $ + * last change: $Author: fs $ $Date: 2007/06/04 20:29:10 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -36,6 +36,8 @@ #ifndef CONNECTIVITY_PARAMWRAPPER_HXX #define CONNECTIVITY_PARAMWRAPPER_HXX +#include <connectivity/FValue.hxx> + /** === begin UNO includes === **/ #ifndef _COM_SUN_STAR_SDBC_XPARAMETERS_HPP_ #include <com/sun/star/sdbc/XParameters.hpp> @@ -46,6 +48,9 @@ #ifndef _COM_SUN_STAR_CONTAINER_XENUMERATIONACCESS_HPP_ #include <com/sun/star/container/XEnumerationAccess.hpp> #endif +#ifndef _COM_SUN_STAR_SDB_XSINGLESELECTQUERYANALYZER_HPP_ +#include <com/sun/star/sdb/XSingleSelectQueryAnalyzer.hpp> +#endif /** === end UNO includes === **/ #include <comphelper/uno3.hxx> @@ -60,6 +65,8 @@ //........................................................................ namespace dbtools { +namespace param +{ //........................................................................ //==================================================================== @@ -75,8 +82,8 @@ private: /// the most recently set value of the parameter - ::com::sun::star::uno::Any m_aValue; - /// the positions (in our m_xValueDestination) at which the value should be set + ::connectivity::ORowSetValue m_aValue; + /// the positions (in our m_xValueDestination) at which the value should be set (0-based!) ::std::vector< sal_Int32 > m_aIndexes; /// the "delegator" column to which standard property requests are forwarded @@ -94,6 +101,10 @@ public: ParameterWrapper( + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColumn + ); + + ParameterWrapper( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColumn, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XParameters >& _rxAllParameters, const ::std::vector< sal_Int32 >& _rIndexes @@ -114,13 +125,25 @@ // prevent method hiding using ::cppu::OPropertySetHelper::getFastPropertyValue; + public: + const ::connectivity::ORowSetValue& Value() const { return m_aValue; } + ::connectivity::ORowSetValue& Value() { return m_aValue; } + protected: ::rtl::OUString impl_getPseudoAggregatePropertyName( sal_Int32 _nHandle ) const; + + private: + ParameterWrapper(); // not implemented }; //==================================================================== //= ParameterWrapperContainer //==================================================================== + typedef ::std::vector< ::rtl::Reference< ParameterWrapper > > Parameters; + + //==================================================================== + //= ParameterWrapperContainer + //==================================================================== typedef ::cppu::WeakImplHelper2 < ::com::sun::star::container::XIndexAccess , ::com::sun::star::container::XEnumerationAccess > ParameterWrapperContainer_Base; @@ -128,9 +151,6 @@ /// class for the parameter event @see approveParameter class ParameterWrapperContainer : public ParameterWrapperContainer_Base { - public: - typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > > Parameters; - private: Parameters m_aParameters; @@ -138,8 +158,17 @@ virtual ~ParameterWrapperContainer(); public: + /** creates an empty container + */ ParameterWrapperContainer(); + /** creates a container from a SingleSelectQuerAnalyzer's parameter columns + + Note that here, the simple constructor of the ParameterWrapper will be used, which does not + use a XParameters instance to forward values to, but only remembers the values itself. + */ + ParameterWrapperContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryAnalyzer >& _rxComposer ); + // ::com::sun::star::container::XElementAccess virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw( ::com::sun::star::uno::RuntimeException ); virtual sal_Bool SAL_CALL hasElements() throw( ::com::sun::star::uno::RuntimeException ); @@ -152,11 +181,28 @@ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 _rIndex) throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException ); public: - Parameters& getParameters() { return m_aParameters; } + const Parameters& getParameters() { return m_aParameters; } + + const ::connectivity::ORowSetValue& operator[]( size_t _index ) const { return m_aParameters[ _index ]->Value(); } + ::connectivity::ORowSetValue& operator[]( size_t _index ) { return m_aParameters[ _index ]->Value(); } + + /** adds an ParameterWrapper to the end of the array + */ + void push_back( ParameterWrapper* _pParameter ) + { + m_aParameters.push_back( _pParameter ); + } + + size_t size() const { return m_aParameters.size(); } }; + //==================================================================== + //= ParamatersContainer + //==================================================================== + typedef ::rtl::Reference< ParameterWrapperContainer > ParametersContainerRef; + //........................................................................ -} // namespace dbtools +} } // namespace dbtools::param //........................................................................ #endif // CONNECTIVITY_PARAMWRAPPER_HXX --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
