-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathstrcvt.h
28 lines (26 loc) · 1.01 KB
/
strcvt.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#pragma once
#include <cassert>
#include <cstdlib>
#include <iostream>
#include <stdexcept>
#include <string>
#include <vector>
namespace strcvt
{
// string coding/type convertor functions
#ifdef _MSC_VER
std::string CvtStringToUTF8(const std::string& localstr);
std::string CvtUTF8ToLocal(const std::string& utf8str);
std::wstring CvtUTF8ToWChar(const std::string& utf8str, int utf8strlen = -1);
std::wstring CvtLocalStringToWString(const std::string& string);
std::string CvtWStringToLocalString(const std::wstring& wstring);
#endif
std::string CvtStringToUTF8(const char16_t& src);
std::string CvtStringToUTF8(const std::u16string& src);
std::string CvtStringToUTF8(const wchar_t* start, std::uint64_t len);
std::string CvtStringToUTF8(const std::wstring& str);
std::u16string CvtStringToUTF16(const std::string& src);
std::u16string CvtStringToUTF16(const char* start, int len);
std::wstring CvtStringToWString(const std::string& src);
std::wstring CvtStringToWString(const char* start, std::uint64_t len);
} //namespace strfunc