From 78e9b00a63dbfce39287c9b3633e6e8bf2611b8b Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 23 May 2009 00:49:31 -0400 Subject: [PATCH] Snapshot --- src/rewrite/StringTable.cpp | 25 +++++++++++++++++++++++++ src/rewrite/StringTable.h | 5 ++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/rewrite/StringTable.cpp b/src/rewrite/StringTable.cpp index b4dd01299..9dac4626f 100644 --- a/src/rewrite/StringTable.cpp +++ b/src/rewrite/StringTable.cpp @@ -25,6 +25,7 @@ // //////////////////////////////////////////////////////////////////////////////// +#include #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 (); +} + +//////////////////////////////////////////////////////////////////////////////// diff --git a/src/rewrite/StringTable.h b/src/rewrite/StringTable.h index 3a608fed5..ef0080d97 100644 --- a/src/rewrite/StringTable.h +++ b/src/rewrite/StringTable.h @@ -38,8 +38,11 @@ public: StringTable& operator= (const StringTable&); // Assignment operator ~StringTable (); // Destructor + void load (const std::string&); + std::string get (int); + private: - std::map mMapping; + std::map mMapping; }; #endif