1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "moduledbu.hxx"
22 #include <tools/resmgr.hxx>
23 #include <svl/solar.hrc>
24 #include <tools/debug.hxx>
26 #define ENTER_MOD_METHOD() \
27 ::osl::MutexGuard aGuard(s_aMutex); \
34 /** implementation for <type>OModule</type>. not threadsafe, has to be guarded by its owner
45 /// get the manager for the resources of the module
46 ResMgr
* getResManager();
49 OModuleImpl::OModuleImpl()
55 OModuleImpl::~OModuleImpl()
62 ResMgr
* OModuleImpl::getResManager()
64 // note that this method is not threadsafe, which counts for the whole class !
68 // create a manager with a fixed prefix
69 m_pResources
= ResMgr::CreateResMgr("dbu");
75 ::osl::Mutex
OModule::s_aMutex
;
76 sal_Int32
OModule::s_nClients
= 0;
77 OModuleImpl
* OModule::s_pImpl
= NULL
;
78 ResMgr
* OModule::getResManager()
81 return s_pImpl
->getResManager();
84 void OModule::registerClient()
86 ::osl::MutexGuard
aGuard(s_aMutex
);
90 void OModule::revokeClient()
92 ::osl::MutexGuard
aGuard(s_aMutex
);
93 if (!--s_nClients
&& s_pImpl
)
100 void OModule::ensureImpl()
104 s_pImpl
= new OModuleImpl();
109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */