project64/Source/Common/StdString.h

65 lines
1.5 KiB
C
Raw Permalink Normal View History

#pragma once
2013-04-17 10:29:48 +00:00
class stdstr;
2022-10-03 08:04:42 +00:00
#include <list>
2013-04-17 10:29:48 +00:00
#include <stdarg.h>
#include <string>
2022-10-03 08:04:42 +00:00
#include <vector>
typedef std::vector<stdstr> strvector;
class stdstr :
public std::string
{
public:
enum
{
CODEPAGE_UTF8 = 65001,
CODEPAGE_932 = 932,
};
stdstr();
stdstr(const std::string & str);
stdstr(const stdstr & str);
stdstr(const char * str);
2022-10-03 08:04:42 +00:00
strvector Tokenize(char delimiter) const;
strvector Tokenize(const char * delimiter) const;
void Format(const char * strFormat, ...);
stdstr & ToLower(void);
stdstr & ToUpper(void);
2022-10-03 08:04:42 +00:00
void Replace(const char search, const char replace);
void Replace(const char * search, const char replace);
void Replace(const std::string & search, const std::string & replace);
2022-10-03 08:04:42 +00:00
stdstr & Trim(const char * chars2remove = "\t ");
stdstr & TrimLeft(const char * chars2remove = "\t ");
stdstr & TrimRight(const char * chars2remove = "\t ");
#ifdef _WIN32
2022-10-03 08:04:42 +00:00
stdstr & FromUTF16(const wchar_t * UTF16Source, bool * bSuccess = nullptr);
2021-04-12 11:35:39 +00:00
std::wstring ToUTF16(unsigned int CodePage = CODEPAGE_UTF8, bool * bSuccess = nullptr) const;
#endif
void ArgFormat(const char * strFormat, va_list & args);
};
class stdstr_f : public stdstr
{
public:
2022-10-03 08:04:42 +00:00
stdstr_f(const char * strFormat, ...);
};
#ifdef _WIN32
2015-11-15 03:12:24 +00:00
class stdwstr_f : public std::wstring
{
public:
2022-10-03 08:04:42 +00:00
stdwstr_f(const wchar_t * strFormat, ...);
2015-11-15 03:12:24 +00:00
};
#endif
2015-11-15 03:12:24 +00:00
typedef std::list<stdstr> strlist;
typedef strlist::iterator strlist_iter;