Snapshot
This commit is contained in:
@@ -25,6 +25,7 @@
|
|||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
#include "StringTable.h"
|
#include "StringTable.h"
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -57,3 +58,27 @@ StringTable::~StringTable ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// [data.location] / language . XX
|
||||||
|
// UTF-8 encoding
|
||||||
|
//
|
||||||
|
// 123 This is the string
|
||||||
|
// 124 This is another string
|
||||||
|
// ...
|
||||||
|
void StringTable::load (const std::string& file)
|
||||||
|
{
|
||||||
|
// TODO Load the specified file.
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
std::string StringTable::get (int id)
|
||||||
|
{
|
||||||
|
// Return the right string.
|
||||||
|
if (mMapping.find (id) != mMapping.end ())
|
||||||
|
return mMapping[id];
|
||||||
|
|
||||||
|
std::stringstream error;
|
||||||
|
error << "MISSING " << id;
|
||||||
|
return error.str ();
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -38,8 +38,11 @@ public:
|
|||||||
StringTable& operator= (const StringTable&); // Assignment operator
|
StringTable& operator= (const StringTable&); // Assignment operator
|
||||||
~StringTable (); // Destructor
|
~StringTable (); // Destructor
|
||||||
|
|
||||||
|
void load (const std::string&);
|
||||||
|
std::string get (int);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::map <std::string, std::string> mMapping;
|
std::map <int, std::string> mMapping;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user