/* * Copyright 2010-2016 OpenXcom Developers. * * This file is part of OpenXcom. * * OpenXcom is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * OpenXcom is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with OpenXcom. If not, see . */ #include "ExtraStrings.h" namespace OpenXcom { /** * Creates a blank set of extra strings data. */ ExtraStrings::ExtraStrings() { } /** * Cleans up the extra strings set. */ ExtraStrings::~ExtraStrings() { } /** * Loads the extra strings set from YAML. * @param node YAML node. */ void ExtraStrings::load(const YAML::Node &node) { for (YAML::const_iterator i = node["strings"].begin(); i != node["strings"].end(); ++i) { // Regular strings if (i->second.IsScalar()) { _strings[i->first.as()] = i->second.as(); } // Strings with plurality else if (i->second.IsMap()) { for (YAML::const_iterator j = i->second.begin(); j != i->second.end(); ++j) { std::string s = i->first.as() + "_" + j->first.as(); _strings[s] = j->second.as(); } } } } /** * Gets the list of strings defined my this mod. * @return The list of strings. */ std::map *ExtraStrings::getStrings() { return &_strings; } }