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
|
|
|
|
2013-04-17 10:29:48 +00:00
|
|
|
#include <stdarg.h>
|
2008-09-18 03:15:49 +00:00
|
|
|
#include <vector>
|
2013-04-17 10:29:48 +00:00
|
|
|
#include <string>
|
2008-09-18 03:15:49 +00:00
|
|
|
#include <list>
|
|
|
|
|
|
|
|
typedef std::vector<stdstr> strvector;
|
|
|
|
|
2013-04-17 10:29:48 +00:00
|
|
|
class stdstr :
|
|
|
|
public std::string
|
2008-09-18 03:15:49 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
stdstr();
|
2013-04-17 10:29:48 +00:00
|
|
|
stdstr( const std::string & str );
|
2008-09-18 03:15:49 +00:00
|
|
|
stdstr( const stdstr & str );
|
2013-04-17 10:29:48 +00:00
|
|
|
stdstr( const char * str );
|
|
|
|
|
|
|
|
strvector Tokenize ( char delimiter ) const;
|
|
|
|
strvector Tokenize ( const char * delimiter ) const;
|
|
|
|
void Format ( const char * strFormat, ... );
|
|
|
|
stdstr& ToLower ( void );
|
|
|
|
stdstr& ToUpper ( void );
|
|
|
|
|
|
|
|
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 );
|
|
|
|
|
|
|
|
stdstr & Trim ( const char * chars2remove = "\t " );
|
|
|
|
stdstr & TrimLeft ( const char * chars2remove = "\t " );
|
|
|
|
stdstr & TrimRight ( const char * chars2remove = "\t " );
|
|
|
|
|
|
|
|
stdstr & FromUTF16 ( const wchar_t * UTF16Source, bool * bSuccess = NULL);
|
|
|
|
std::wstring ToUTF16 ( bool * bSuccess = NULL);
|
|
|
|
|
|
|
|
void ArgFormat( const char * strFormat, va_list & args);
|
|
|
|
|
2008-09-18 03:15:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class stdstr_f: public stdstr
|
|
|
|
{
|
|
|
|
public:
|
2013-04-17 10:29:48 +00:00
|
|
|
stdstr_f(const char * strFormat, ...)
|
2008-09-18 03:15:49 +00:00
|
|
|
{
|
|
|
|
va_list args;
|
|
|
|
va_start(args, strFormat);
|
2013-01-29 10:40:35 +00:00
|
|
|
ArgFormat(strFormat,args);
|
2008-09-18 03:15:49 +00:00
|
|
|
va_end(args);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef std::list<stdstr> strlist;
|
|
|
|
typedef strlist::iterator strlist_iter;
|