summaryrefslogtreecommitdiff
path: root/MapTool/wii/stringtablebuilder.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'MapTool/wii/stringtablebuilder.cpp')
-rw-r--r--MapTool/wii/stringtablebuilder.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/MapTool/wii/stringtablebuilder.cpp b/MapTool/wii/stringtablebuilder.cpp
new file mode 100644
index 0000000..d1f2d2b
--- /dev/null
+++ b/MapTool/wii/stringtablebuilder.cpp
@@ -0,0 +1,25 @@
+#include "stringtablebuilder.h"
+
+WiiStringTableBuilder::WiiStringTableBuilder() {
+ m_nextOffset = 0;
+ m_data = "";
+}
+
+quint32 WiiStringTableBuilder::add(QString str) {
+ if (m_lookup.contains(str))
+ return m_lookup.value(str);
+
+ quint32 added = m_nextOffset;
+ m_lookup.insert(str, added);
+
+ m_data.append(str.toAscii());
+ m_data.append('\0');
+
+ m_nextOffset = m_data.length();
+
+ return added;
+}
+
+QByteArray WiiStringTableBuilder::pack() const {
+ return m_data;
+}