summaryrefslogtreecommitdiff
path: root/src/resources/db/unitsdb.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/resources/db/unitsdb.cpp')
-rw-r--r--src/resources/db/unitsdb.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/resources/db/unitsdb.cpp b/src/resources/db/unitsdb.cpp
index 3001ccb7b..94d055ffd 100644
--- a/src/resources/db/unitsdb.cpp
+++ b/src/resources/db/unitsdb.cpp
@@ -214,11 +214,18 @@ void UnitsDb::loadXmlFile(const std::string &fileName,
const std::string type = XML::getProperty(node, "type", "");
UnitDescription ud = loadUnit(node);
if (type == "weight")
+ {
defaultWeight = ud;
+ }
else if (type == "currency")
+ {
defaultCurrency = ud;
+ mCurrencies["default"] = ud;
+ }
else
+ {
logger->log("Error unknown unit type: %s", type.c_str());
+ }
}
else if (xmlNameEqual(node, "currency"))
{
@@ -318,6 +325,11 @@ std::string UnitsDb::formatWeight(const int value)
return formatUnit(value, defaultWeight);
}
+bool UnitsDb::existsCurrency(const std::string &name)
+{
+ return mCurrencies.find(name) != mCurrencies.end();
+}
+
static std::string splitNumber(std::string str,
const std::string &separator)
{