aboutsummaryrefslogtreecommitdiff
path: root/tools/pe_bliss/message_table.cpp
diff options
context:
space:
mode:
authormasoud bh2015-09-24 02:39:26 +0330
committermasoud bh2015-11-09 02:24:01 +0330
commit55b8c3ee48b690e0b801351ef0819b08b038b9d6 (patch)
tree13f568280f85e63b862540dcd069a46107161118 /tools/pe_bliss/message_table.cpp
parent24f3f43457ac6bdeed95c1ed0a882387a509078a (diff)
downloadgodot-55b8c3ee48b690e0b801351ef0819b08b038b9d6.tar.gz
godot-55b8c3ee48b690e0b801351ef0819b08b038b9d6.tar.zst
godot-55b8c3ee48b690e0b801351ef0819b08b038b9d6.zip
Diffstat (limited to 'tools/pe_bliss/message_table.cpp')
-rw-r--r--tools/pe_bliss/message_table.cpp60
1 files changed, 60 insertions, 0 deletions
diff --git a/tools/pe_bliss/message_table.cpp b/tools/pe_bliss/message_table.cpp
new file mode 100644
index 000000000..940387dd2
--- /dev/null
+++ b/tools/pe_bliss/message_table.cpp
@@ -0,0 +1,60 @@
+#include "message_table.h"
+#include "utils.h"
+
+namespace pe_bliss
+{
+//Default constructor
+message_table_item::message_table_item()
+ :unicode_(false)
+{}
+
+//Constructor from ANSI string
+message_table_item::message_table_item(const std::string& str)
+ :unicode_(false), ansi_str_(str)
+{
+ pe_utils::strip_nullbytes(ansi_str_);
+}
+
+//Constructor from UNICODE string
+message_table_item::message_table_item(const std::wstring& str)
+ :unicode_(true), unicode_str_(str)
+{
+ pe_utils::strip_nullbytes(unicode_str_);
+}
+
+//Returns true if contained string is unicode
+bool message_table_item::is_unicode() const
+{
+ return unicode_;
+}
+
+//Returns ANSI string
+const std::string& message_table_item::get_ansi_string() const
+{
+ return ansi_str_;
+}
+
+//Returns UNICODE string
+const std::wstring& message_table_item::get_unicode_string() const
+{
+ return unicode_str_;
+}
+
+//Sets ANSI string (clears UNICODE one)
+void message_table_item::set_string(const std::string& str)
+{
+ ansi_str_ = str;
+ pe_utils::strip_nullbytes(ansi_str_);
+ unicode_str_.clear();
+ unicode_ = false;
+}
+
+//Sets UNICODE string (clears ANSI one)
+void message_table_item::set_string(const std::wstring& str)
+{
+ unicode_str_ = str;
+ pe_utils::strip_nullbytes(unicode_str_);
+ ansi_str_.clear();
+ unicode_ = true;
+}
+}