From 0355e4e96e9a234a1d97c642bc3f02dd8f55a3d3 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Thu, 12 Mar 2015 02:14:13 +0000 Subject: [PATCH] added more constructors to Cstr, Mcstr, Wcstr --- qse/include/qse/Cstr.hpp | 36 ++++++++++++++++++++++++++++++++++++ qse/lib/awk/Awk.cpp | 2 +- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/qse/include/qse/Cstr.hpp b/qse/include/qse/Cstr.hpp index facb6634..1744bb51 100644 --- a/qse/include/qse/Cstr.hpp +++ b/qse/include/qse/Cstr.hpp @@ -39,6 +39,18 @@ QSE_BEGIN_NAMESPACE(QSE) class Mcstr: public Types::mcstr_t, public Hashable { public: + Mcstr (qse_mchar_t* ptr) + { + this->ptr = ptr; + this->len = qse_mbslen(ptr); + } + + Mcstr (const qse_mchar_t* ptr) + { + this->ptr = (qse_mchar_t*)ptr; + this->len = qse_mbslen(ptr); + } + Mcstr (qse_mchar_t* ptr, qse_size_t len) { this->ptr = ptr; @@ -77,6 +89,18 @@ public: class Wcstr: public Types::wcstr_t, public Hashable { public: + Wcstr (qse_wchar_t* ptr) + { + this->ptr = ptr; + this->len = qse_wcslen(ptr); + } + + Wcstr (const qse_wchar_t* ptr) + { + this->ptr = (qse_wchar_t*)ptr; + this->len = qse_wcslen(ptr); + } + Wcstr (qse_wchar_t* ptr, qse_size_t len) { this->ptr = ptr; @@ -115,6 +139,18 @@ public: class Cstr: public Types::cstr_t, public Hashable { public: + Cstr (qse_char_t* ptr) + { + this->ptr = ptr; + this->len = qse_strlen(ptr); + } + + Cstr (const qse_char_t* ptr) + { + this->ptr = (qse_char_t*)ptr; + this->len = qse_strlen(ptr); + } + Cstr (qse_char_t* ptr, qse_size_t len) { this->ptr = ptr; diff --git a/qse/lib/awk/Awk.cpp b/qse/lib/awk/Awk.cpp index 7a2be378..d03f3cd2 100644 --- a/qse/lib/awk/Awk.cpp +++ b/qse/lib/awk/Awk.cpp @@ -1736,7 +1736,7 @@ int Awk::deleteFunction (const char_t* name) #if defined(QSE_AWK_USE_HTB_FOR_FUNCTION_MAP) qse_htb_delete (this->functionMap, name, qse_strlen(name)); #else - this->functionMap.remove (Cstr(name, qse_strlen(name))); + this->functionMap.remove (Cstr(name)); #endif } else this->retrieveError ();