project64/Source/Common/std string.h

56 lines
1.4 KiB
C
Raw Normal View History

#pragma once
2013-04-17 10:29:48 +00:00
class stdstr;
2013-04-17 10:29:48 +00:00
#include <stdarg.h>
#include <vector>
2013-04-17 10:29:48 +00:00
#include <string>
#include <list>
typedef std::vector<stdstr> strvector;
2013-04-17 10:29:48 +00:00
class stdstr :
public std::string
{
public:
stdstr();
2013-04-17 10:29:48 +00:00
stdstr( const std::string & str );
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);
};
class stdstr_f: public stdstr
{
public:
2013-04-17 10:29:48 +00:00
stdstr_f(const char * strFormat, ...)
{
va_list args;
va_start(args, strFormat);
ArgFormat(strFormat,args);
va_end(args);
}
};
typedef std::list<stdstr> strlist;
typedef strlist::iterator strlist_iter;