#ifndef _STCONV_H_
#define _STCONV_H_

#include "common_type.h"

#include <uchar.h>
#include <iostream>
#include <string>
#include <codecvt>
#include <cassert>
#include <locale>

using namespace std;

// 002690C8
bool UnicodeToUTF8(char* pOutput0, const wchar_t* pWBuf1, uint dOutputLen2);

// 00268EDC
int UTF8ToUnicode(wchar_t*, char const*, uint);

// 00268E4C
void AsciiToUnicode(wchar_t*, char const*, uint);

// 00268E6E
void UnicodeToAscii(char*, wchar_t const*, uint, char);

// 00268E9E
char* UTF8ToAscii(char* pOutAscii0, char const* pUtf81, uint dLen2, char c3);

std::u16string s2ws(const std::string& str);
std::string ws2s(const std::u16string& wstr);

int strlen16(const char16_t* strarg);

string trim(const string& str);
vector<string> string_split(string s, char delim);
void string_replace(std::string& data, std::string toSearch, std::string replaceStr);
void u16string_replace(std::u16string& data, std::u16string toSearch, std::u16string replaceStr);

// 002691E4
wchar_t* CreateStringCopy(const wchar_t* pStr);

// 00269218
char* CreateStringCopy(const char* pStr);

size_t xstrlen(const wchar_t* pbuf);
wchar_t* xstrchr(const wchar_t* pbuf, wchar_t c);
wchar_t* xstrrchr(const wchar_t* pbuf, wchar_t c);
char* strlwr(char* pBuf);  // 0014D150

string Unicode2String(char16_t const* pWBuf);

// 00268C3C
size_t strlcpy(unsigned char* a1, unsigned char* a2, int a3);

// 00268C3C
ulong xstrlcpy(wchar_t* a1, const wchar_t* a2, unsigned int a3);

// 00268CD2
int xstrcmp(const wchar_t* a1, const wchar_t* a2);

// 00268DB2
const wchar_t* xstrstr(wchar_t const*, wchar_t const*);

// 00268C74
size_t xstrlcat(wchar_t*, const wchar_t*, unsigned int);
#endif  //_STCONV_H_