added more constructors to Cstr, Mcstr, Wcstr

This commit is contained in:
hyung-hwan 2015-03-12 02:14:13 +00:00
parent 47a7baeb7d
commit 0355e4e96e
2 changed files with 37 additions and 1 deletions

View File

@ -39,6 +39,18 @@ QSE_BEGIN_NAMESPACE(QSE)
class Mcstr: public Types::mcstr_t, public Hashable class Mcstr: public Types::mcstr_t, public Hashable
{ {
public: 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) Mcstr (qse_mchar_t* ptr, qse_size_t len)
{ {
this->ptr = ptr; this->ptr = ptr;
@ -77,6 +89,18 @@ public:
class Wcstr: public Types::wcstr_t, public Hashable class Wcstr: public Types::wcstr_t, public Hashable
{ {
public: 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) Wcstr (qse_wchar_t* ptr, qse_size_t len)
{ {
this->ptr = ptr; this->ptr = ptr;
@ -115,6 +139,18 @@ public:
class Cstr: public Types::cstr_t, public Hashable class Cstr: public Types::cstr_t, public Hashable
{ {
public: 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) Cstr (qse_char_t* ptr, qse_size_t len)
{ {
this->ptr = ptr; this->ptr = ptr;

View File

@ -1736,7 +1736,7 @@ int Awk::deleteFunction (const char_t* name)
#if defined(QSE_AWK_USE_HTB_FOR_FUNCTION_MAP) #if defined(QSE_AWK_USE_HTB_FOR_FUNCTION_MAP)
qse_htb_delete (this->functionMap, name, qse_strlen(name)); qse_htb_delete (this->functionMap, name, qse_strlen(name));
#else #else
this->functionMap.remove (Cstr(name, qse_strlen(name))); this->functionMap.remove (Cstr(name));
#endif #endif
} }
else this->retrieveError (); else this->retrieveError ();