summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-05-16 21:47:32 +0100
committerCaolán McNamara <caolanm@redhat.com>2011-05-20 15:23:39 +0100
commit12dd16959f11336ac2829151a401d46655ddc6a8 (patch)
tree90758492e35e69d8a3c37e589f62ec1ae3d260d3
parent81d10064500f40ce730168da3b290f98f0116d1b (diff)
move argument generation into ctor
-rw-r--r--unotools/inc/unotools/bootstrap.hxx2
-rw-r--r--unotools/source/config/bootstrap.cxx32
2 files changed, 17 insertions, 17 deletions
diff --git a/unotools/inc/unotools/bootstrap.hxx b/unotools/inc/unotools/bootstrap.hxx
index d17e2940890d..38a5a117c045 100644
--- a/unotools/inc/unotools/bootstrap.hxx
+++ b/unotools/inc/unotools/bootstrap.hxx
@@ -131,7 +131,7 @@ namespace utl
public:
// singleton impl-class
class Impl;
- static Impl const& data(); // the data related to the bootstrap.ini file
+ static const Impl& data(); // the data related to the bootstrap.ini file
};
//-----------------------------------------------------------------------------
} // namespace utl
diff --git a/unotools/source/config/bootstrap.cxx b/unotools/source/config/bootstrap.cxx
index 8c5b9344a5f4..660da1ec3a20 100644
--- a/unotools/source/config/bootstrap.cxx
+++ b/unotools/source/config/bootstrap.cxx
@@ -86,9 +86,21 @@ namespace utl
// Implementation class: Bootstrap::Impl
// ---------------------------------------------------------------------------------------
+ namespace
+ {
+ rtl::OUString makeImplName()
+ {
+ rtl::OUString uri;
+ rtl::Bootstrap::get(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BRAND_BASE_DIR")),
+ uri);
+ return uri + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/program/"BOOTSTRAP_DATA_NAME));
+ }
+ }
+
class Bootstrap::Impl
{
- OUString const m_aImplName;
+ const OUString m_aImplName;
public: // struct to cache the result of a path lookup
struct PathData
{
@@ -115,9 +127,7 @@ namespace utl
Status status_;
public: // construction and initialization
- explicit
- Impl(OUString const& _aImplName)
- : m_aImplName(_aImplName)
+ Impl() : m_aImplName(makeImplName())
{
status_ = initialize();
}
@@ -134,26 +144,16 @@ namespace utl
bool initBaseInstallationData(rtl::Bootstrap& _rData);
bool initUserInstallationData(rtl::Bootstrap& _rData);
};
-// ---------------------------------------------------------------------------------------
- static OUString getExecutableDirectory();
-// ---------------------------------------------------------------------------------------
static Bootstrap::Impl* s_pData = NULL;
- Bootstrap::Impl const& Bootstrap::data()
+ const Bootstrap::Impl& Bootstrap::data()
{
-
if (!s_pData)
{
using namespace osl;
MutexGuard aGuard( Mutex::getGlobalMutex() );
-
- // static Impl s_theData(getExecutableDirectory() + OUString(RTL_CONSTASCII_USTRINGPARAM("/"BOOTSTRAP_DATA_NAME)));
- // s_pData = &s_theData;
- rtl::OUString uri;
- rtl::Bootstrap::get(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BRAND_BASE_DIR")), uri);
- s_pData = new Impl(uri + OUString(RTL_CONSTASCII_USTRINGPARAM("/program/"BOOTSTRAP_DATA_NAME)));
+ s_pData = new Impl;
}
return *s_pData;
}