use well behaved singletons

This commit is contained in:
Caolán McNamara 2011-05-30 15:31:27 +01:00
parent f90cb6c111
commit dd11d24026
2 changed files with 22 additions and 6 deletions

View file

@ -93,8 +93,8 @@ class UNOTOOLS_DLLPUBLIC DefaultFontConfiguration
rtl::OUString tryLocale( const com::sun::star::lang::Locale& rLocale, const rtl::OUString& rType ) const;
DefaultFontConfiguration();
public:
DefaultFontConfiguration();
~DefaultFontConfiguration();
static DefaultFontConfiguration& get();
@ -207,8 +207,8 @@ private:
unsigned long getSubstType( const com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > xFont,
const rtl::OUString& rType ) const;
void readLocaleSubst( const com::sun::star::lang::Locale& rLocale ) const;
FontSubstConfiguration();
public:
FontSubstConfiguration();
~FontSubstConfiguration();
static FontSubstConfiguration& get();

View file

@ -37,6 +37,7 @@
#include <unotools/configpathes.hxx>
#include <unotools/syslocale.hxx>
#include <rtl/ustrbuf.hxx>
#include <rtl/instance.hxx>
#include <sal/macros.h>
#include <tools/debug.hxx>
@ -96,10 +97,18 @@ static const char* getKeyType( int nKeyType )
}
}
namespace
{
class theDefaultFontConfiguration
: public rtl::Static<DefaultFontConfiguration,
theDefaultFontConfiguration>
{
};
}
DefaultFontConfiguration& DefaultFontConfiguration::get()
{
static DefaultFontConfiguration aDefaultFontConfiguration;
return aDefaultFontConfiguration;
return theDefaultFontConfiguration::get();
}
DefaultFontConfiguration::DefaultFontConfiguration()
@ -370,10 +379,17 @@ OUString DefaultFontConfiguration::getUserInterfaceFont( const Locale& rLocale )
* FontSubstConfigItem::get
*/
namespace
{
class theFontSubstConfiguration
: public rtl::Static<FontSubstConfiguration, theFontSubstConfiguration>
{
};
}
FontSubstConfiguration& FontSubstConfiguration::get()
{
static FontSubstConfiguration aFontSubstConfiguration;
return aFontSubstConfiguration;
return theFontSubstConfiguration::get();
}
/*