summaryrefslogtreecommitdiffstats
path: root/vdstestlib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2017-01-02 21:51:34 +0100
committerHenning Baldersheim <balder@yahoo-inc.com>2017-01-02 21:51:34 +0100
commitfce96792a770cf00dea6ff232b158555e7476e65 (patch)
tree117aec907240af7ab8c616b4d54a5baa1badad1e /vdstestlib
parent6158c3e9d0fcb720aa6b58ec08735e92298341f1 (diff)
Move implementation to cpp file and use explicit instantiation.
Diffstat (limited to 'vdstestlib')
-rw-r--r--vdstestlib/src/vespa/vdstestlib/cppunit/dirconfig.cpp18
-rw-r--r--vdstestlib/src/vespa/vdstestlib/cppunit/dirconfig.h15
2 files changed, 20 insertions, 13 deletions
diff --git a/vdstestlib/src/vespa/vdstestlib/cppunit/dirconfig.cpp b/vdstestlib/src/vespa/vdstestlib/cppunit/dirconfig.cpp
index 666ea593b89..fbcf15d23c0 100644
--- a/vdstestlib/src/vespa/vdstestlib/cppunit/dirconfig.cpp
+++ b/vdstestlib/src/vespa/vdstestlib/cppunit/dirconfig.cpp
@@ -142,6 +142,24 @@ DirConfig::getConfig(const ConfigName& name, bool createIfNonExisting)
return it->second;
}
+template<typename T>
+void
+DirConfig::Config::setValue(const ConfigKey& key, const T& value)
+{
+ std::ostringstream ost;
+ ost << value;
+ set(key, ost.str());
+}
+
+template<typename T>
+T
+DirConfig::Config::getValue(const ConfigKey& key, const T& defVal) const
+{
+ const ConfigValue* val(get(key));
+ if (val == 0) return defVal;
+ return boost::lexical_cast<T>(*val);
+}
+
void
DirConfig::removeConfig(const ConfigName& name)
{
diff --git a/vdstestlib/src/vespa/vdstestlib/cppunit/dirconfig.h b/vdstestlib/src/vespa/vdstestlib/cppunit/dirconfig.h
index 116f2f76e93..5fe933fb689 100644
--- a/vdstestlib/src/vespa/vdstestlib/cppunit/dirconfig.h
+++ b/vdstestlib/src/vespa/vdstestlib/cppunit/dirconfig.h
@@ -17,7 +17,6 @@
*/
#pragma once
-#include <boost/lexical_cast.hpp>
#include <list>
#include <map>
#include <string>
@@ -41,21 +40,11 @@ struct DirConfig {
void set(const ConfigKey&); // Set valueless key, such as array size
void set(const ConfigKey&, const ConfigValue&);
template<typename T>
- void setValue(const ConfigKey& key, const T& value)
- {
- std::ostringstream ost;
- ost << value;
- set(key, ost.str());
- }
+ void setValue(const ConfigKey& key, const T& value);
void remove(const ConfigKey&);
const ConfigValue* get(const ConfigKey&) const;
template<typename T>
- T getValue(const ConfigKey& key, const T& defVal) const
- {
- const ConfigValue* val(get(key));
- if (val == 0) return defVal;
- return boost::lexical_cast<T>(*val);
- }
+ T getValue(const ConfigKey& key, const T& defVal) const;
};
DirConfig();