summaryrefslogtreecommitdiff
path: root/src/common/intern-pool.hpp
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2013-06-29 23:23:43 -0700
committerBen Longbons <b.r.longbons@gmail.com>2013-08-01 15:19:45 -0700
commit3b98f3439e33b15bba2036c402f9925340fdb2b9 (patch)
treef6a59330bb747d9cc64f5f83d06e7f76dc01d540 /src/common/intern-pool.hpp
parent8d1480c1be7c9741876d89008277a2b3629a4d01 (diff)
downloadtmwa-3b98f3439e33b15bba2036c402f9925340fdb2b9.tar.gz
tmwa-3b98f3439e33b15bba2036c402f9925340fdb2b9.tar.bz2
tmwa-3b98f3439e33b15bba2036c402f9925340fdb2b9.tar.xz
tmwa-3b98f3439e33b15bba2036c402f9925340fdb2b9.zip
Poison std::string and use the various string classes
Diffstat (limited to 'src/common/intern-pool.hpp')
-rw-r--r--src/common/intern-pool.hpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/common/intern-pool.hpp b/src/common/intern-pool.hpp
index caa54e4..db840a2 100644
--- a/src/common/intern-pool.hpp
+++ b/src/common/intern-pool.hpp
@@ -4,16 +4,19 @@
#include <cassert>
#include <map>
-#include <string>
#include <vector>
+#include "strings.hpp"
+
class InternPool
{
- std::map<std::string, size_t> known;
- std::vector<std::string> names;
+ std::map<FString, size_t> known;
+ std::vector<FString> names;
public:
- size_t intern(const std::string& name)
+ size_t intern(XString name_)
{
+ FString name = name_;
+ // hm, I could change this to do aliases
auto pair = known.insert({name, known.size()});
if (pair.second)
names.push_back(name);
@@ -21,7 +24,7 @@ public:
return pair.first->second;
}
- const std::string& outtern(size_t sz) const
+ ZString outtern(size_t sz) const
{
return names[sz];
}