Win32: Added @uptime template token and MS_UPTIME stringid to goldlang.cfg

This commit is contained in:
Ianos Gnatiuc
2007-01-19 17:38:41 +00:00
parent c265a58103
commit 2c67afec51
17 changed files with 62 additions and 18 deletions

View File

@@ -151,6 +151,10 @@ char* strcvtc(char* s);
#define PRINTF_DECLARE_BUFFER(b) b, ARRAYSIZE(b), __FILE__, __LINE__
int gsprintf(TCHAR* buffer, size_t sizeOfBuffer, const TCHAR* __file, int __line, const TCHAR* format, ...);
// ------------------------------------------------------------------
std::string &FormatString(std::string &format, const char *token, const char *replace);
std::string &FormatString(std::string &format, const char *token, size_t replace);
// ------------------------------------------------------------------
// String tokenizer class

View File

@@ -771,4 +771,30 @@ void tokenize(gstrarray &array, const TCHAR* str, const TCHAR *delim)
}
// ------------------------------------------------------------------
std::string &FormatString(std::string &format, const char *token, const char *replace)
{
size_t tokenLen = strlen(token);
size_t pos = format.find(token);
for (; pos != std::string::npos; pos = format.find(token))
{
format.replace(pos, tokenLen, replace);
}
return format;
}
// ------------------------------------------------------------------
std::string &FormatString(std::string &format, const char *token, size_t replace)
{
char buff[128];
gsprintf(PRINTF_DECLARE_BUFFER(buff), "%u", replace);
return FormatString(format, token, buff);
}
// ------------------------------------------------------------------