diff options
author | Treeki <treeki@gmail.com> | 2011-03-12 23:17:12 +0100 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2011-03-12 23:17:12 +0100 |
commit | 7d4e4c0b34a613dd3c0220475ae4e448197522c1 (patch) | |
tree | 4f5cee367de3fdef4f9a7c84af59ffe76a2bb1c3 /MapTool/wii/stringtablebuilder.cpp | |
download | kamek-7d4e4c0b34a613dd3c0220475ae4e448197522c1.tar.gz kamek-7d4e4c0b34a613dd3c0220475ae4e448197522c1.zip |
initial commit. now I can start playing with stuff!
Diffstat (limited to '')
-rw-r--r-- | MapTool/wii/stringtablebuilder.cpp | 25 |
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; +} |