This commit is contained in:
Paul Beckingham 2009-05-23 00:49:31 -04:00
parent 5ac3f0c47e
commit 78e9b00a63
2 changed files with 29 additions and 1 deletions

View file

@ -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 ();
}
////////////////////////////////////////////////////////////////////////////////

View file

@ -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