Tag: cws_dev300_dba31b User: oj Date: 2008-08-12 11:26:22+0000 Modified: dba/dbaccess/source/core/api/RowSetBase.hxx dba/dbaccess/source/core/dataaccess/ModelImpl.hxx dba/dbaccess/source/core/inc/core_resource.hxx dba/dbaccess/source/core/misc/dsntypes.cxx dba/dbaccess/source/core/resource/core_resource.cxx
Log: #i92092# moved dsntypes to dba File Changes: Directory: /dba/dbaccess/source/core/api/ ========================================= File [changed]: RowSetBase.hxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/api/RowSetBase.hxx?r1=1.39&r2=1.39.68.1 Delta lines: +4 -3 ------------------- --- RowSetBase.hxx 2008-04-10 12:26:28+0000 1.39 +++ RowSetBase.hxx 2008-08-12 11:26:18+0000 1.39.68.1 @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: RowSetBase.hxx,v $ - * $Revision: 1.39 $ + * $Revision: 1.39.68.1 $ * * This file is part of OpenOffice.org. * @@ -93,7 +93,7 @@ #ifndef DBACCESS_ROWSETCACHEITERATOR_HXX #include "RowSetCacheIterator.hxx" #endif - +#include "core_resource.hxx" #include <comphelper/componentcontext.hxx> #include <functional> @@ -127,6 +127,7 @@ public ::comphelper::OPropertyStateContainer, public ::comphelper::OPropertyArrayUsageHelper<ORowSetBase> // this class hold the static property info { + OModuleClient m_aModuleClient; protected: typedef ::std::vector<ORowSetDataColumn*> TDataColumns; ::osl::Mutex* m_pMutex; // this the mutex form the rowset itself Directory: /dba/dbaccess/source/core/dataaccess/ ================================================ File [changed]: ModelImpl.hxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/ModelImpl.hxx?r1=1.24&r2=1.24.26.1 Delta lines: +4 -2 ------------------- --- ModelImpl.hxx 2008-06-25 12:30:50+0000 1.24 +++ ModelImpl.hxx 2008-08-12 11:26:19+0000 1.24.26.1 @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: ModelImpl.hxx,v $ - * $Revision: 1.24 $ + * $Revision: 1.24.26.1 $ * * This file is part of OpenOffice.org. * @@ -34,6 +34,7 @@ #include "apitools.hxx" #include "bookmarkcontainer.hxx" #include "ContentHelper.hxx" +#include "core_resource.hxx" /** === begin UNO includes === **/ #include <com/sun/star/beans/PropertyAttribute.hpp> @@ -152,6 +153,7 @@ }; private: + OModuleClient m_aModuleClient; ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XModel > m_xModel; ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XDataSource > m_xDataSource; Directory: /dba/dbaccess/source/core/inc/ ========================================= File [changed]: core_resource.hxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/inc/core_resource.hxx?r1=1.5.68.1&r2=1.5.68.2 Delta lines: +23 -12 --------------------- --- core_resource.hxx 2008-08-12 10:23:40+0000 1.5.68.1 +++ core_resource.hxx 2008-08-12 11:26:19+0000 1.5.68.2 @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: core_resource.hxx,v $ - * $Revision: 1.5.68.1 $ + * $Revision: 1.5.68.2 $ * * This file is part of OpenOffice.org. * @@ -34,6 +34,7 @@ #ifndef _RTL_USTRING_HXX_ #include <rtl/ustring.hxx> #endif +#include <osl/mutex.hxx> class ResMgr; //......................................................................... @@ -52,6 +53,9 @@ //================================================================== class ResourceManager { + friend class OModuleClient; + static ::osl::Mutex s_aMutex; /// access safety + static sal_Int32 s_nClients; /// number of registered clients static ResMgr* m_pImpl; private: @@ -59,18 +63,12 @@ ResourceManager() { } ~ResourceManager() { } - // we'll instantiate one static member of the following class, which, in it's dtor, - // ensures that m_pImpl will be deleted - class EnsureDelete - { - public: - EnsureDelete() { } - ~EnsureDelete(); - }; - friend class EnsureDelete; - protected: static void ensureImplExists(); + /// register a client for the module + static void registerClient(); + /// revoke a client for the module + static void revokeClient(); public: /** loads the string with the specified resource id @@ -95,6 +93,19 @@ static ResMgr* getResManager(); }; + //========================================================================= + //= OModuleClient + //========================================================================= + /** base class for objects which uses any global module-specific ressources + */ + class OModuleClient + { + public: + OModuleClient() { ResourceManager::registerClient(); } + ~OModuleClient() { ResourceManager::revokeClient(); } + }; + + //......................................................................... } //......................................................................... Directory: /dba/dbaccess/source/core/misc/ ========================================== File [changed]: dsntypes.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/misc/dsntypes.cxx?r1=1.1.2.1&r2=1.1.2.2 Delta lines: +7 -1 ------------------- --- dsntypes.cxx 2008-08-12 10:24:25+0000 1.1.2.1 +++ dsntypes.cxx 2008-08-12 11:26:19+0000 1.1.2.2 @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: dsntypes.cxx,v $ - * $Revision: 1.1.2.1 $ + * $Revision: 1.1.2.2 $ * * This file is part of OpenOffice.org. * @@ -606,6 +606,12 @@ return nPos < m_aUserExtensions.size() ? m_aUserExtensions[nPos] : String(); } //------------------------------------------------------------------------- +bool ODsnTypeCollection::isEmbeddedDatabase( DATASOURCE_TYPE _eType ) const +{ + // the only known embedded type so far is DST_EMBEDDED_HSQLDB + return ( _eType == DST_EMBEDDED_HSQLDB ); +} +//------------------------------------------------------------------------- ODsnTypeCollection::TypeIterator ODsnTypeCollection::begin() const { return TypeIterator(this, 0); Directory: /dba/dbaccess/source/core/resource/ ============================================== File [changed]: core_resource.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/resource/core_resource.cxx?r1=1.11.68.1&r2=1.11.68.2 Delta lines: +22 -15 --------------------- --- core_resource.cxx 2008-08-12 10:23:41+0000 1.11.68.1 +++ core_resource.cxx 2008-08-12 11:26:19+0000 1.11.68.2 @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: core_resource.cxx,v $ - * $Revision: 1.11.68.1 $ + * $Revision: 1.11.68.2 $ * * This file is part of OpenOffice.org. * @@ -52,15 +52,11 @@ //================================================================== //= ResourceManager //================================================================== + ::osl::Mutex ResourceManager::s_aMutex; + sal_Int32 ResourceManager::s_nClients = 0; ResMgr* ResourceManager::m_pImpl = NULL; //------------------------------------------------------------------ - ResourceManager::EnsureDelete::~EnsureDelete() - { - delete ResourceManager::m_pImpl; - } - - //------------------------------------------------------------------ void ResourceManager::ensureImplExists() { if (m_pImpl) @@ -71,12 +67,6 @@ ByteString sFileName("dba"); m_pImpl = ResMgr::CreateResMgr(sFileName.GetBuffer(), aLocale); - - if (m_pImpl) - { - // now that we have an impl class make sure it's deleted on unloading the library - static ResourceManager::EnsureDelete s_aDeleteTheImplClass; - } } //------------------------------------------------------------------ @@ -98,12 +88,29 @@ sString.SearchAndReplaceAscii( _pPlaceholderAscii, _rReplace ); return sString; } - //------------------------------------------------------------------ + //------------------------------------------------------------------------- + void ResourceManager::registerClient() + { + ::osl::MutexGuard aGuard(s_aMutex); + ++s_nClients; + } + + //------------------------------------------------------------------------- + void ResourceManager::revokeClient() + { + ::osl::MutexGuard aGuard(s_aMutex); + if (!--s_nClients && m_pImpl) + { + delete m_pImpl; + m_pImpl = NULL; + } + } ResMgr* ResourceManager::getResManager() { ensureImplExists(); return m_pImpl; } + //......................................................................... } //......................................................................... --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
