/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ #ifndef INCLUDED_CONNECTIVITY_COMMONTOOLS_HXX #define INCLUDED_CONNECTIVITY_COMMONTOOLS_HXX #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace com { namespace sun { namespace star { namespace util { struct Date; struct DateTime; struct Time; } }}} #if HAVE_FEATURE_JAVA namespace jvmaccess { class VirtualMachine; } #endif namespace connectivity { OOO_DLLPUBLIC_DBTOOLS bool match(const sal_Unicode* pWild, const sal_Unicode* pStr, const sal_Unicode cEscape); inline bool match(const OUString &rWild, const OUString &rStr, const sal_Unicode cEscape) { return match(rWild.getStr(), rStr.getStr(), cEscape); } // typedefs typedef std::vector< ::com::sun::star::uno::WeakReferenceHelper > OWeakRefArray; typedef ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XColumnsSupplier> OSQLTable; typedef std::map OSQLTables; // class ORefVector allows reference counting on a std::vector template< class VectorVal > class ORefVector { std::vector< VectorVal > m_vector; oslInterlockedCount m_refCount; protected: virtual ~ORefVector(){} public: typedef std::vector< VectorVal > Vector; ORefVector() : m_refCount(0) {} ORefVector(size_t _st) : m_vector(_st) , m_refCount(0) {} ORefVector(const ORefVector& _rRH) : m_vector(_rRH.m_vector),m_refCount(0) { } ORefVector& operator=(const ORefVector& _rRH) { if ( &_rRH != this ) { m_vector = _rRH.m_vector; } return *this; } std::vector< VectorVal > & get() { return m_vector; } std::vector< VectorVal > const & get() const { return m_vector; } inline static void * SAL_CALL operator new( size_t nSize ) { return ::rtl_allocateMemory( nSize ); } inline static void SAL_CALL operator delete( void * pMem ) { ::rtl_freeMemory( pMem ); } inline static void * SAL_CALL operator new( size_t, void * pMem ) { return pMem; } inline static void SAL_CALL operator delete( void *, void * ) {} void acquire() { osl_atomic_increment( &m_refCount ); } void release() { if (! osl_atomic_decrement( &m_refCount )) delete this; } }; // class ORowVector incudes refcounting and initialze himself // with at least one element. This first element is reserved for // the bookmark template< class VectorVal > class ORowVector : public ORefVector< VectorVal > { public: ORowVector() : ORefVector< VectorVal >(1){} ORowVector(size_t _st) : ORefVector< VectorVal >(_st+1) {} }; typedef ORefVector< ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> > OSQLColumns; // search from __first to __last the column with the name _rVal // when no such column exist __last is returned OOO_DLLPUBLIC_DBTOOLS OSQLColumns::Vector::const_iterator find( OSQLColumns::Vector::const_iterator __first, OSQLColumns::Vector::const_iterator __last, const OUString& _rVal, const ::comphelper::UStringMixEqual& _rCase); // search from __first to __last the column with the realname _rVal // when no such column exist __last is returned OOO_DLLPUBLIC_DBTOOLS OSQLColumns::Vector::const_iterator findRealName( OSQLColumns::Vector::const_iterator __first, OSQLColumns::Vector::const_iterator __last, const OUString& _rVal, const ::comphelper::UStringMixEqual& _rCase); // the first two find methods are much faster than the one below // search from __first to __last the column with the property _rProp equals the value _rVal // when no such column exist __last is returned OOO_DLLPUBLIC_DBTOOLS OSQLColumns::Vector::const_iterator find( OSQLColumns::Vector::const_iterator __first, OSQLColumns::Vector::const_iterator __last, const OUString& _rProp, const OUString& _rVal, const ::comphelper::UStringMixEqual& _rCase); OOO_DLLPUBLIC_DBTOOLS void checkDisposed(bool _bThrow) throw ( ::com::sun::star::lang::DisposedException ); #if HAVE_FEATURE_JAVA /** creates a java virtual machine @param _rxContext The ORB. @return The JavaVM. */ OOO_DLLPUBLIC_DBTOOLS ::rtl::Reference< jvmaccess::VirtualMachine > getJavaVM(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext); /** return if the java class exists, otherwise . @param _pJVM The JavaVM. @param _sClassName The class name to look for. */ OOO_DLLPUBLIC_DBTOOLS bool existsJavaClassByName( const ::rtl::Reference< jvmaccess::VirtualMachine >& _pJVM,const OUString& _sClassName ); #endif } #define DECLARE_SERVICE_INFO() \ virtual OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; \ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; \ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE \ #define IMPLEMENT_SERVICE_INFO(classname, implasciiname, serviceasciiname) \ OUString SAL_CALL classname::getImplementationName( ) throw (::com::sun::star::uno::RuntimeException, std::exception) \ { \ return OUString::createFromAscii(implasciiname); \ } \ ::com::sun::star::uno::Sequence< OUString > SAL_CALL classname::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException, std::exception) \ { \ ::com::sun::star::uno::Sequence< OUString > aSupported(1); \ aSupported[0] = OUString::createFromAscii(serviceasciiname); \ return aSupported; \ } \ sal_Bool SAL_CALL classname::supportsService( const OUString& _rServiceName ) throw(::com::sun::star::uno::RuntimeException, std::exception) \ { \ return cppu::supportsService(this, _rServiceName); \ } \ #endif // INCLUDED_CONNECTIVITY_COMMONTOOLS_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ or-24.2'>distro/vector/vector-24.2 LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
AgeCommit message (Expand)Author
2015-10-21com::sun::star->css in include/cppuNoel Grandin
2015-06-08loplugin:cstylecast: deal with remaining pointer castsStephan Bergmann
2015-04-15remove unnecessary use of void in function declarationsNoel Grandin
2015-04-01Add support for cppu::UnoType<void>Stephan Bergmann
2015-04-01MSVC 2013 doesn't define __cplusplus >= 201103LStephan Bergmann
2015-04-01Make cppu::UnoType<decltype(x)>::get() work when x is of reference typeStephan Bergmann
2015-03-29Clean up template-parameter-dependent C-style castsStephan Bergmann
2015-03-28Clean up C-style casts from pointers to voidStephan Bergmann
2015-02-07loplugin:deletedspecialStephan Bergmann
2015-01-20Some more loplugin:cstylecast: cppuStephan Bergmann
2014-11-18cppu: clean up public headers with include-what-you-useMichael Stahl
2014-11-18unotype.hxx: fix documentation copypastaMichael Stahl
2014-09-02Related fdo#82088: removing and shortening aliasesStefan Weiberg
2014-06-05cppu: remove SAL_THROW macroNoel Grandin
2014-04-19fixincludeguards.sh: includeThomas Arnhold
2014-04-03remove unnecessary scope qualifier from sal_Bool usesNoel Grandin
2014-01-28cppu: Let C++ inline functions return bool instead of sal_BoolStephan Bergmann
2014-01-10[API CHANGE] cppu::Enterable::v_isValid returns boolStephan Bergmann
2013-12-16CPPU_CURRENT_NAMESPACE is impl detail, mark @deprecatedStephan Bergmann
2013-12-16Clean-up uno/lbnames.hStephan Bergmann
2013-11-09fdo#65108 inter-module includes <> include/cppuNorbert Thiebaud
2013-10-23fixincludeguards.sh: include/c*Thomas Arnhold
2013-09-07s/wiki.services.openoffice.org/wiki.openoffice.org/gAndras Timar