22 lines
636 B
C++
22 lines
636 B
C++
#pragma once
|
|
#include <string>
|
|
#include <string_view>
|
|
#include <unordered_map>
|
|
#include <vector>
|
|
|
|
namespace playground {
|
|
|
|
// Excel 2003 XML Spreadsheet string files. Later loads override keys.
|
|
class StringTable {
|
|
public:
|
|
bool loadXml(std::string_view xml, std::string* error = nullptr);
|
|
const std::string* find(std::string_view key) const;
|
|
std::string get(std::string_view key) const;
|
|
std::string format(std::string_view key, const std::vector<std::string>& args) const;
|
|
size_t size() const { return values_.size(); }
|
|
|
|
private:
|
|
std::unordered_map<std::string, std::string> values_;
|
|
};
|
|
|
|
} // namespace playground
|