diff options
Diffstat (limited to 'src/resources')
-rw-r--r-- | src/resources/db/textdb.cpp | 17 | ||||
-rw-r--r-- | src/resources/db/textdb.h | 6 |
2 files changed, 21 insertions, 2 deletions
diff --git a/src/resources/db/textdb.cpp b/src/resources/db/textdb.cpp index 28198162d..8a8771535 100644 --- a/src/resources/db/textdb.cpp +++ b/src/resources/db/textdb.cpp @@ -30,7 +30,7 @@ namespace { - std::vector<std::string> mTexts; + StringVect mTexts; } // namespace void TextDb::load() @@ -85,3 +85,18 @@ void TextDb::unload() { mTexts.clear(); } + +const StringVect &TextDb::getTexts() +{ + return mTexts; +} + +std::string TextDb::getByIndex(const int index) +{ + if (index < 0 || + static_cast<size_t>(index) >= mTexts.size()) + { + return std::string(); + } + return mTexts[index]; +} diff --git a/src/resources/db/textdb.h b/src/resources/db/textdb.h index 977b49ec6..c61bb0c7a 100644 --- a/src/resources/db/textdb.h +++ b/src/resources/db/textdb.h @@ -23,7 +23,7 @@ #include "enums/simpletypes/skiperror.h" -#include <string> +#include "utils/stringvector.h" #include "localconsts.h" @@ -34,6 +34,10 @@ namespace TextDb void loadXmlFile(const std::string &fileName, const SkipError skipError); + std::string getByIndex(const int index); + + const StringVect &getTexts(); + void unload(); } // namespace LanguageDB |