![]() |
Shadowrun: Awakened 29 September 2011 - Build 871
|
#include "WindowsIncludes.h"#include <stdio.h>#include <stdlib.h>#include <iostream>#include <map>#include <memory>
Include dependency graph for WorldServer/Utils.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Functions | |
| __inline std::string | convertString (const wchar_t *string) |
| __inline wchar_t * | convertString (const std::string &string) |
| __inline std::string convertString | ( | const wchar_t * | string | ) |
Converts from a wchar_t* to std::string instance
Definition at line 34 of file WorldServer/Utils.h.
{
size_t size = wcslen(string);
size_t outCharCount;
char *buf = new char[sizeof(wchar_t)*size];
wcstombs_s(&outCharCount, buf, size, string, size);
std::string ret(buf);
delete[] buf;
return ret;
}
| __inline wchar_t* convertString | ( | const std::string & | string | ) |
Converts from a std::string to wchar_t* instance
Definition at line 48 of file WorldServer/Utils.h.
{
//the memory allocated here should theoretically be managed by the DLLBind mechanism, so there is no corresponding delete
//If at a later time, we find a memory leak in the applicable, this could be it.
wchar_t *ret = new wchar_t[string.size()];
size_t size = (size_t)string.size();
size_t outCharCount;
mbstowcs_s(&outCharCount, ret, size, string.c_str(),size);
return ret;
}Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.