2008-09-18 03:15:49 +00:00
|
|
|
#pragma once
|
|
|
|
|
2013-04-17 10:29:48 +00:00
|
|
|
class stdstr;
|
2008-09-18 03:15:49 +00:00
|
|
|
|
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>
|
2008-09-18 03:15:49 +00:00
|
|
|
|
|
|
|
typedef std::vector<stdstr> strvector;
|
|
|
|
|
2015-11-30 10:14:14 +00:00
|
|
|
class stdstr :
|
|
|
|
public std::string
|
2008-09-18 03:15:49 +00:00
|
|
|
{
|
|
|
|
public:
|
2015-11-30 10:14:14 +00:00
|
|
|
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);
|
2015-11-30 10:14:14 +00:00
|
|
|
|
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);
|
2015-11-30 10:14:14 +00:00
|
|
|
|
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 ");
|
2015-11-30 10:14:14 +00:00
|
|
|
|
2016-01-05 10:32:18 +00:00
|
|
|
#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;
|
2016-01-05 10:32:18 +00:00
|
|
|
#endif
|
2015-11-30 10:14:14 +00:00
|
|
|
|
|
|
|
void ArgFormat(const char * strFormat, va_list & args);
|
|
|
|
};
|
2008-09-18 03:15:49 +00:00
|
|
|
|
2015-11-30 10:14:14 +00:00
|
|
|
class stdstr_f : public stdstr
|
2008-09-18 03:15:49 +00:00
|
|
|
{
|
|
|
|
public:
|
2022-10-03 08:04:42 +00:00
|
|
|
stdstr_f(const char * strFormat, ...);
|
2008-09-18 03:15:49 +00:00
|
|
|
};
|
|
|
|
|
2016-01-12 19:01:13 +00:00
|
|
|
#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
|
|
|
};
|
2016-01-12 19:01:13 +00:00
|
|
|
#endif
|
2015-11-15 03:12:24 +00:00
|
|
|
|
2018-11-18 01:06:02 +00:00
|
|
|
typedef std::list<stdstr> strlist;
|
|
|
|
typedef strlist::iterator strlist_iter;
|