aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEinar Johan Trøan Sømåen2012-07-03 06:20:09 +0200
committerEinar Johan Trøan Sømåen2012-07-03 06:20:09 +0200
commit2457d3860470a757ccf7f008c5638c6a7b5af1de (patch)
treebe8817df4df0a5b13315804bde3f7a6f5e5749d3
parent8596c6a91e7189a2c23d92c0282e8fbb8b66b08b (diff)
downloadscummvm-rg350-2457d3860470a757ccf7f008c5638c6a7b5af1de.tar.gz
scummvm-rg350-2457d3860470a757ccf7f008c5638c6a7b5af1de.tar.bz2
scummvm-rg350-2457d3860470a757ccf7f008c5638c6a7b5af1de.zip
WINTERMUTE: Rename FuncName->funcName in PathUtil and StringUtil
-rw-r--r--engines/wintermute/Ad/AdSentence.cpp6
-rw-r--r--engines/wintermute/Base/BFileManager.cpp6
-rw-r--r--engines/wintermute/Base/BFontBitmap.cpp8
-rw-r--r--engines/wintermute/Base/BFontTT.cpp10
-rw-r--r--engines/wintermute/Base/BGame.cpp6
-rw-r--r--engines/wintermute/Base/BImage.cpp2
-rw-r--r--engines/wintermute/Base/BRegistry.cpp8
-rw-r--r--engines/wintermute/Base/BSoundMgr.cpp10
-rw-r--r--engines/wintermute/Base/BSprite.cpp4
-rw-r--r--engines/wintermute/Base/BStringTable.cpp2
-rw-r--r--engines/wintermute/Base/scriptables/SXString.cpp60
-rw-r--r--engines/wintermute/Base/scriptables/ScEngine.cpp2
-rw-r--r--engines/wintermute/Base/scriptables/ScValue.cpp2
-rw-r--r--engines/wintermute/UI/UIEdit.cpp10
-rw-r--r--engines/wintermute/utils/PathUtil.cpp50
-rw-r--r--engines/wintermute/utils/PathUtil.h28
-rw-r--r--engines/wintermute/utils/StringUtil.cpp50
-rw-r--r--engines/wintermute/utils/StringUtil.h44
-rw-r--r--engines/wintermute/utils/utils.cpp6
19 files changed, 157 insertions, 157 deletions
diff --git a/engines/wintermute/Ad/AdSentence.cpp b/engines/wintermute/Ad/AdSentence.cpp
index 41d4c3745d..d95fd313e0 100644
--- a/engines/wintermute/Ad/AdSentence.cpp
+++ b/engines/wintermute/Ad/AdSentence.cpp
@@ -246,10 +246,10 @@ HRESULT CAdSentence::setupTalkFile(const char *soundFilename) {
if (!soundFilename) return S_OK;
- AnsiString path = PathUtil::GetDirectoryName(soundFilename);
- AnsiString name = PathUtil::GetFileNameWithoutExtension(soundFilename);
+ AnsiString path = PathUtil::getDirectoryName(soundFilename);
+ AnsiString name = PathUtil::getFileNameWithoutExtension(soundFilename);
- AnsiString talkDefFileName = PathUtil::Combine(path, name + ".talk");
+ AnsiString talkDefFileName = PathUtil::combine(path, name + ".talk");
Common::SeekableReadStream *file = Game->_fileManager->openFile(talkDefFileName.c_str());
if (file) {
diff --git a/engines/wintermute/Base/BFileManager.cpp b/engines/wintermute/Base/BFileManager.cpp
index 9e98412021..12167624ae 100644
--- a/engines/wintermute/Base/BFileManager.cpp
+++ b/engines/wintermute/Base/BFileManager.cpp
@@ -656,11 +656,11 @@ HRESULT CBFileManager::registerPackage(const char *Path, const char *name, bool
//////////////////////////////////////////////////////////////////////////
bool CBFileManager::isValidPackage(const AnsiString &fileName) const {
- AnsiString plainName = PathUtil::GetFileNameWithoutExtension(fileName);
+ AnsiString plainName = PathUtil::getFileNameWithoutExtension(fileName);
// check for device-type specific packages
- if (StringUtil::StartsWith(plainName, "xdevice_", true)) {
- return StringUtil::CompareNoCase(plainName, "xdevice_" + Game->GetDeviceType());
+ if (StringUtil::startsWith(plainName, "xdevice_", true)) {
+ return StringUtil::compareNoCase(plainName, "xdevice_" + Game->GetDeviceType());
}
return true;
}
diff --git a/engines/wintermute/Base/BFontBitmap.cpp b/engines/wintermute/Base/BFontBitmap.cpp
index b12116446f..ccbeb6dd80 100644
--- a/engines/wintermute/Base/BFontBitmap.cpp
+++ b/engines/wintermute/Base/BFontBitmap.cpp
@@ -86,8 +86,8 @@ int CBFontBitmap::getTextWidth(byte *text, int MaxLength) {
AnsiString str;
if (Game->_textEncoding == TEXT_UTF8) {
- WideString wstr = StringUtil::Utf8ToWide(Utf8String((char *)text));
- str = StringUtil::WideToAnsi(wstr);
+ WideString wstr = StringUtil::utf8ToWide(Utf8String((char *)text));
+ str = StringUtil::wideToAnsi(wstr);
} else {
str = AnsiString((char *)text);
}
@@ -116,8 +116,8 @@ int CBFontBitmap::textHeightDraw(byte *text, int x, int y, int width, TTextAlig
AnsiString str;
if (Game->_textEncoding == TEXT_UTF8) {
- WideString wstr = StringUtil::Utf8ToWide(Utf8String((char *)text));
- str = StringUtil::WideToAnsi(wstr);
+ WideString wstr = StringUtil::utf8ToWide(Utf8String((char *)text));
+ str = StringUtil::wideToAnsi(wstr);
} else {
str = AnsiString((char *)text);
}
diff --git a/engines/wintermute/Base/BFontTT.cpp b/engines/wintermute/Base/BFontTT.cpp
index 2eee39e9c9..9b4bb3ddff 100644
--- a/engines/wintermute/Base/BFontTT.cpp
+++ b/engines/wintermute/Base/BFontTT.cpp
@@ -124,8 +124,8 @@ void CBFontTT::initLoop() {
int CBFontTT::getTextWidth(byte *Text, int MaxLength) {
WideString text;
- if (Game->_textEncoding == TEXT_UTF8) text = StringUtil::Utf8ToWide((char *)Text);
- else text = StringUtil::AnsiToWide((char *)Text);
+ if (Game->_textEncoding == TEXT_UTF8) text = StringUtil::utf8ToWide((char *)Text);
+ else text = StringUtil::ansiToWide((char *)Text);
if (MaxLength >= 0 && text.size() > MaxLength)
text = Common::String(text.c_str(), MaxLength);
@@ -141,8 +141,8 @@ int CBFontTT::getTextWidth(byte *Text, int MaxLength) {
int CBFontTT::getTextHeight(byte *Text, int Width) {
WideString text;
- if (Game->_textEncoding == TEXT_UTF8) text = StringUtil::Utf8ToWide((char *)Text);
- else text = StringUtil::AnsiToWide((char *)Text);
+ if (Game->_textEncoding == TEXT_UTF8) text = StringUtil::utf8ToWide((char *)Text);
+ else text = StringUtil::ansiToWide((char *)Text);
int textWidth, textHeight;
@@ -640,7 +640,7 @@ HRESULT CBFontTT::initFont() {
Common::SeekableReadStream *file = Game->_fileManager->openFile(_fontFile);
if (!file) {
// the requested font file is not in wme file space; try loading a system font
- AnsiString fontFileName = PathUtil::Combine(CBPlatform::GetSystemFontPath(), PathUtil::GetFileName(_fontFile));
+ AnsiString fontFileName = PathUtil::combine(CBPlatform::GetSystemFontPath(), PathUtil::getFileName(_fontFile));
file = Game->_fileManager->openFile(fontFileName.c_str(), false);
if (!file) {
Game->LOG(0, "Error loading TrueType font '%s'", _fontFile);
diff --git a/engines/wintermute/Base/BGame.cpp b/engines/wintermute/Base/BGame.cpp
index 92c611698b..f2908c9d96 100644
--- a/engines/wintermute/Base/BGame.cpp
+++ b/engines/wintermute/Base/BGame.cpp
@@ -517,7 +517,7 @@ void CBGame::DEBUG_DebugEnable(const char *filename) {
//else _dEBUG_LogFile = fopen("./zz_debug.log", "a+");
if (!_dEBUG_LogFile) {
- AnsiString safeLogFileName = PathUtil::GetSafeLogFileName();
+ AnsiString safeLogFileName = PathUtil::getSafeLogFileName();
//_dEBUG_LogFile = fopen(safeLogFileName.c_str(), "a+");
}
@@ -3898,12 +3898,12 @@ HRESULT CBGame::GetSaveSlotFilename(int Slot, char *Buffer) {
//////////////////////////////////////////////////////////////////////////
AnsiString CBGame::GetDataDir() {
- AnsiString userDir = PathUtil::GetUserDirectory();
+ AnsiString userDir = PathUtil::getUserDirectory();
#ifdef __IPHONEOS__
return userDir;
#else
AnsiString baseDir = _registry->GetBasePath();
- return PathUtil::Combine(userDir, baseDir);
+ return PathUtil::combine(userDir, baseDir);
#endif
}
diff --git a/engines/wintermute/Base/BImage.cpp b/engines/wintermute/Base/BImage.cpp
index 95f6f5bbbf..31a3772964 100644
--- a/engines/wintermute/Base/BImage.cpp
+++ b/engines/wintermute/Base/BImage.cpp
@@ -73,7 +73,7 @@ CBImage::~CBImage() {
HRESULT CBImage::loadFile(const Common::String &filename) {
_filename = filename;
- if (StringUtil::StartsWith(filename, "savegame:", true)) {
+ if (StringUtil::startsWith(filename, "savegame:", true)) {
_decoder = new Graphics::BitmapDecoder();
} else if (filename.hasSuffix(".png")) {
_decoder = new Graphics::PNGDecoder();
diff --git a/engines/wintermute/Base/BRegistry.cpp b/engines/wintermute/Base/BRegistry.cpp
index c39e1e69f1..efc2c77d88 100644
--- a/engines/wintermute/Base/BRegistry.cpp
+++ b/engines/wintermute/Base/BRegistry.cpp
@@ -99,7 +99,7 @@ int CBRegistry::ReadInt(const AnsiString &subKey, const AnsiString &key, int ini
//////////////////////////////////////////////////////////////////////////
bool CBRegistry::WriteInt(const AnsiString &subKey, const AnsiString &key, int value) {
- WriteString(subKey, key, StringUtil::ToString(value));
+ WriteString(subKey, key, StringUtil::toString(value));
return true;
}
@@ -139,17 +139,17 @@ char *CBRegistry::GetIniName() {
//////////////////////////////////////////////////////////////////////////
void CBRegistry::LoadValues(bool local) {
if (local) LoadXml("settings.xml", _localValues);
- else LoadXml(PathUtil::Combine(Game->GetDataDir(), "settings.xml"), _values);
+ else LoadXml(PathUtil::combine(Game->GetDataDir(), "settings.xml"), _values);
}
//////////////////////////////////////////////////////////////////////////
void CBRegistry::SaveValues() {
- SaveXml(PathUtil::Combine(Game->GetDataDir(), "settings.xml"), _values);
+ SaveXml(PathUtil::combine(Game->GetDataDir(), "settings.xml"), _values);
}
//////////////////////////////////////////////////////////////////////////
void CBRegistry::SetBasePath(const char *basePath) {
- _basePath = PathUtil::GetFileNameWithoutExtension(basePath);
+ _basePath = PathUtil::getFileNameWithoutExtension(basePath);
LoadValues(false);
}
diff --git a/engines/wintermute/Base/BSoundMgr.cpp b/engines/wintermute/Base/BSoundMgr.cpp
index ff5858c91e..18e674687c 100644
--- a/engines/wintermute/Base/BSoundMgr.cpp
+++ b/engines/wintermute/Base/BSoundMgr.cpp
@@ -132,12 +132,12 @@ CBSoundBuffer *CBSoundMgr::addSound(const char *Filename, TSoundType Type, bool
CBSoundBuffer *sound;
// try to switch WAV to OGG file (if available)
- AnsiString ext = PathUtil::GetExtension(Filename);
- if (StringUtil::CompareNoCase(ext, "wav")) {
- AnsiString path = PathUtil::GetDirectoryName(Filename);
- AnsiString name = PathUtil::GetFileNameWithoutExtension(Filename);
+ AnsiString ext = PathUtil::getExtension(Filename);
+ if (StringUtil::compareNoCase(ext, "wav")) {
+ AnsiString path = PathUtil::getDirectoryName(Filename);
+ AnsiString name = PathUtil::getFileNameWithoutExtension(Filename);
- AnsiString newFile = PathUtil::Combine(path, name + "ogg");
+ AnsiString newFile = PathUtil::combine(path, name + "ogg");
if (Game->_fileManager->hasFile(newFile)) {
Filename = newFile.c_str();
}
diff --git a/engines/wintermute/Base/BSprite.cpp b/engines/wintermute/Base/BSprite.cpp
index 07b8bc8b1d..ae5a185cc4 100644
--- a/engines/wintermute/Base/BSprite.cpp
+++ b/engines/wintermute/Base/BSprite.cpp
@@ -135,8 +135,8 @@ HRESULT CBSprite::loadFile(const char *Filename, int LifeTime, TSpriteCacheType
HRESULT ret;
- AnsiString ext = PathUtil::GetExtension(Filename);
- if (StringUtil::StartsWith(Filename, "savegame:", true) || StringUtil::CompareNoCase(ext, "bmp") || StringUtil::CompareNoCase(ext, "tga") || StringUtil::CompareNoCase(ext, "png") || StringUtil::CompareNoCase(ext, "jpg")) {
+ AnsiString ext = PathUtil::getExtension(Filename);
+ if (StringUtil::startsWith(Filename, "savegame:", true) || StringUtil::compareNoCase(ext, "bmp") || StringUtil::compareNoCase(ext, "tga") || StringUtil::compareNoCase(ext, "png") || StringUtil::compareNoCase(ext, "jpg")) {
CBFrame *frame = new CBFrame(Game);
CBSubFrame *subframe = new CBSubFrame(Game);
subframe->setSurface(Filename, true, 0, 0, 0, LifeTime, true);
diff --git a/engines/wintermute/Base/BStringTable.cpp b/engines/wintermute/Base/BStringTable.cpp
index 794af32ab7..be8707b41f 100644
--- a/engines/wintermute/Base/BStringTable.cpp
+++ b/engines/wintermute/Base/BStringTable.cpp
@@ -59,7 +59,7 @@ HRESULT CBStringTable::AddString(const char *Key, const char *Val, bool ReportDu
}
Common::String final_key = Key;
- StringUtil::ToLowerCase(final_key);
+ StringUtil::toLowerCase(final_key);
_stringsIter = _strings.find(final_key);
if (_stringsIter != _strings.end() && ReportDuplicities) Game->LOG(0, " Warning: Duplicate definition of string '%s'.", final_key.c_str());
diff --git a/engines/wintermute/Base/scriptables/SXString.cpp b/engines/wintermute/Base/scriptables/SXString.cpp
index 1e3b1b0bf9..58cce4d7bb 100644
--- a/engines/wintermute/Base/scriptables/SXString.cpp
+++ b/engines/wintermute/Base/scriptables/SXString.cpp
@@ -113,17 +113,17 @@ HRESULT CSXString::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
//try {
WideString str;
if (Game->_textEncoding == TEXT_UTF8)
- str = StringUtil::Utf8ToWide(_string);
+ str = StringUtil::utf8ToWide(_string);
else
- str = StringUtil::AnsiToWide(_string);
+ str = StringUtil::ansiToWide(_string);
//WideString subStr = str.substr(start, end - start + 1);
WideString subStr(str.c_str() + start, end - start + 1);
if (Game->_textEncoding == TEXT_UTF8)
- stack->pushString(StringUtil::WideToUtf8(subStr).c_str());
+ stack->pushString(StringUtil::wideToUtf8(subStr).c_str());
else
- stack->pushString(StringUtil::WideToAnsi(subStr).c_str());
+ stack->pushString(StringUtil::wideToAnsi(subStr).c_str());
// } catch (std::exception &) {
// stack->pushNULL();
// }
@@ -151,17 +151,17 @@ HRESULT CSXString::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
// try {
WideString str;
if (Game->_textEncoding == TEXT_UTF8)
- str = StringUtil::Utf8ToWide(_string);
+ str = StringUtil::utf8ToWide(_string);
else
- str = StringUtil::AnsiToWide(_string);
+ str = StringUtil::ansiToWide(_string);
// WideString subStr = str.substr(start, len);
WideString subStr(str.c_str() + start, len);
if (Game->_textEncoding == TEXT_UTF8)
- stack->pushString(StringUtil::WideToUtf8(subStr).c_str());
+ stack->pushString(StringUtil::wideToUtf8(subStr).c_str());
else
- stack->pushString(StringUtil::WideToAnsi(subStr).c_str());
+ stack->pushString(StringUtil::wideToAnsi(subStr).c_str());
// } catch (std::exception &) {
// stack->pushNULL();
// }
@@ -177,16 +177,16 @@ HRESULT CSXString::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
WideString str;
if (Game->_textEncoding == TEXT_UTF8)
- str = StringUtil::Utf8ToWide(_string);
+ str = StringUtil::utf8ToWide(_string);
else
- str = StringUtil::AnsiToWide(_string);
+ str = StringUtil::ansiToWide(_string);
- StringUtil::ToUpperCase(str);
+ StringUtil::toUpperCase(str);
if (Game->_textEncoding == TEXT_UTF8)
- stack->pushString(StringUtil::WideToUtf8(str).c_str());
+ stack->pushString(StringUtil::wideToUtf8(str).c_str());
else
- stack->pushString(StringUtil::WideToAnsi(str).c_str());
+ stack->pushString(StringUtil::wideToAnsi(str).c_str());
return S_OK;
}
@@ -199,16 +199,16 @@ HRESULT CSXString::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
WideString str;
if (Game->_textEncoding == TEXT_UTF8)
- str = StringUtil::Utf8ToWide(_string);
+ str = StringUtil::utf8ToWide(_string);
else
- str = StringUtil::AnsiToWide(_string);
+ str = StringUtil::ansiToWide(_string);
- StringUtil::ToLowerCase(str);
+ StringUtil::toLowerCase(str);
if (Game->_textEncoding == TEXT_UTF8)
- stack->pushString(StringUtil::WideToUtf8(str).c_str());
+ stack->pushString(StringUtil::wideToUtf8(str).c_str());
else
- stack->pushString(StringUtil::WideToAnsi(str).c_str());
+ stack->pushString(StringUtil::wideToAnsi(str).c_str());
return S_OK;
}
@@ -224,17 +224,17 @@ HRESULT CSXString::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
WideString str;
if (Game->_textEncoding == TEXT_UTF8)
- str = StringUtil::Utf8ToWide(_string);
+ str = StringUtil::utf8ToWide(_string);
else
- str = StringUtil::AnsiToWide(_string);
+ str = StringUtil::ansiToWide(_string);
WideString toFind;
if (Game->_textEncoding == TEXT_UTF8)
- toFind = StringUtil::Utf8ToWide(strToFind);
+ toFind = StringUtil::utf8ToWide(strToFind);
else
- toFind = StringUtil::AnsiToWide(strToFind);
+ toFind = StringUtil::ansiToWide(strToFind);
- int indexOf = StringUtil::IndexOf(str, toFind, index);
+ int indexOf = StringUtil::indexOf(str, toFind, index);
stack->pushInt(indexOf);
return S_OK;
@@ -258,15 +258,15 @@ HRESULT CSXString::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
WideString str;
if (Game->_textEncoding == TEXT_UTF8)
- str = StringUtil::Utf8ToWide(_string);
+ str = StringUtil::utf8ToWide(_string);
else
- str = StringUtil::AnsiToWide(_string);
+ str = StringUtil::ansiToWide(_string);
WideString delims;
if (Game->_textEncoding == TEXT_UTF8)
- delims = StringUtil::Utf8ToWide(Separators);
+ delims = StringUtil::utf8ToWide(Separators);
else
- delims = StringUtil::AnsiToWide(Separators);
+ delims = StringUtil::ansiToWide(Separators);
Common::Array<WideString> parts;
@@ -299,9 +299,9 @@ HRESULT CSXString::scCallMethod(CScScript *script, CScStack *stack, CScStack *th
WideString &part = (*it);
if (Game->_textEncoding == TEXT_UTF8)
- Val = new CScValue(Game, StringUtil::WideToUtf8(part).c_str());
+ Val = new CScValue(Game, StringUtil::wideToUtf8(part).c_str());
else
- Val = new CScValue(Game, StringUtil::WideToAnsi(part).c_str());
+ Val = new CScValue(Game, StringUtil::wideToAnsi(part).c_str());
Array->push(Val);
delete Val;
@@ -332,7 +332,7 @@ CScValue *CSXString::scGetProperty(const char *name) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Length") == 0) {
if (Game->_textEncoding == TEXT_UTF8) {
- WideString wstr = StringUtil::Utf8ToWide(_string);
+ WideString wstr = StringUtil::utf8ToWide(_string);
_scValue->setInt(wstr.size());
} else
_scValue->setInt(strlen(_string));
diff --git a/engines/wintermute/Base/scriptables/ScEngine.cpp b/engines/wintermute/Base/scriptables/ScEngine.cpp
index b7ab360b82..deeaeb1443 100644
--- a/engines/wintermute/Base/scriptables/ScEngine.cpp
+++ b/engines/wintermute/Base/scriptables/ScEngine.cpp
@@ -805,7 +805,7 @@ void CScEngine::AddScriptTime(const char *Filename, uint32 Time) {
if (!_isProfiling) return;
AnsiString fileName = Filename;
- StringUtil::ToLowerCase(fileName);
+ StringUtil::toLowerCase(fileName);
_scriptTimes[fileName] += Time;
}
diff --git a/engines/wintermute/Base/scriptables/ScValue.cpp b/engines/wintermute/Base/scriptables/ScValue.cpp
index 04872fb4ae..d762f14feb 100644
--- a/engines/wintermute/Base/scriptables/ScValue.cpp
+++ b/engines/wintermute/Base/scriptables/ScValue.cpp
@@ -169,7 +169,7 @@ CScValue *CScValue::getProp(const char *name) {
#endif
Game->_scValue->setInt(strlen(_valString));
} else {
- WideString wstr = StringUtil::Utf8ToWide(_valString);
+ WideString wstr = StringUtil::utf8ToWide(_valString);
Game->_scValue->setInt(wstr.size());
}
diff --git a/engines/wintermute/UI/UIEdit.cpp b/engines/wintermute/UI/UIEdit.cpp
index c17bd405ab..2dec9c139f 100644
--- a/engines/wintermute/UI/UIEdit.cpp
+++ b/engines/wintermute/UI/UIEdit.cpp
@@ -444,8 +444,8 @@ CScValue *CUIEdit::scGetProperty(const char *name) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Text") == 0) {
if (Game->_textEncoding == TEXT_UTF8) {
- WideString wstr = StringUtil::AnsiToWide(_text);
- _scValue->setString(StringUtil::WideToUtf8(wstr).c_str());
+ WideString wstr = StringUtil::ansiToWide(_text);
+ _scValue->setString(StringUtil::wideToUtf8(wstr).c_str());
} else {
_scValue->setString(_text);
}
@@ -515,8 +515,8 @@ HRESULT CUIEdit::scSetProperty(const char *name, CScValue *value) {
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Text") == 0) {
if (Game->_textEncoding == TEXT_UTF8) {
- WideString wstr = StringUtil::Utf8ToWide(value->getString());
- setText(StringUtil::WideToAnsi(wstr).c_str());
+ WideString wstr = StringUtil::utf8ToWide(value->getString());
+ setText(StringUtil::wideToAnsi(wstr).c_str());
} else {
setText(value->getString());
}
@@ -775,7 +775,7 @@ bool CUIEdit::handleKeypress(Common::Event *event, bool printable) {
//WideString wstr = StringUtil::Utf8ToWide(event->kbd.ascii);
WideString wstr;
wstr += (char)event->kbd.ascii;
- _selEnd += insertChars(_selEnd, (byte *)StringUtil::WideToAnsi(wstr).c_str(), 1);
+ _selEnd += insertChars(_selEnd, (byte *)StringUtil::wideToAnsi(wstr).c_str(), 1);
if (Game->_textRTL) _selEnd = _selStart;
else _selStart = _selEnd;
diff --git a/engines/wintermute/utils/PathUtil.cpp b/engines/wintermute/utils/PathUtil.cpp
index f975ea6199..cc1f2f3d44 100644
--- a/engines/wintermute/utils/PathUtil.cpp
+++ b/engines/wintermute/utils/PathUtil.cpp
@@ -34,7 +34,7 @@
namespace WinterMute {
//////////////////////////////////////////////////////////////////////////
-AnsiString PathUtil::UnifySeparators(const AnsiString &path) {
+AnsiString PathUtil::unifySeparators(const AnsiString &path) {
AnsiString newPath = path;
AnsiString::iterator it;
@@ -45,37 +45,37 @@ AnsiString PathUtil::UnifySeparators(const AnsiString &path) {
}
//////////////////////////////////////////////////////////////////////////
-AnsiString PathUtil::NormalizeFileName(const AnsiString &path) {
- AnsiString newPath = UnifySeparators(path);
- StringUtil::ToLowerCase(newPath);
+AnsiString PathUtil::normalizeFileName(const AnsiString &path) {
+ AnsiString newPath = unifySeparators(path);
+ StringUtil::toLowerCase(newPath);
return newPath;
}
//////////////////////////////////////////////////////////////////////////
-AnsiString PathUtil::Combine(const AnsiString &path1, const AnsiString &path2) {
- AnsiString newPath1 = UnifySeparators(path1);
- AnsiString newPath2 = UnifySeparators(path2);
+AnsiString PathUtil::combine(const AnsiString &path1, const AnsiString &path2) {
+ AnsiString newPath1 = unifySeparators(path1);
+ AnsiString newPath2 = unifySeparators(path2);
- if (!StringUtil::EndsWith(newPath1, "/", true) && !StringUtil::StartsWith(newPath2, "/", true))
+ if (!StringUtil::endsWith(newPath1, "/", true) && !StringUtil::startsWith(newPath2, "/", true))
newPath1 += "/";
return newPath1 + newPath2;
}
//////////////////////////////////////////////////////////////////////////
-AnsiString PathUtil::GetDirectoryName(const AnsiString &path) {
- AnsiString newPath = UnifySeparators(path);
+AnsiString PathUtil::getDirectoryName(const AnsiString &path) {
+ AnsiString newPath = unifySeparators(path);
//size_t pos = newPath.find_last_of(L'/');
- Common::String filename = GetFileName(path);
+ Common::String filename = getFileName(path);
return Common::String(path.c_str(), path.size() - filename.size());
//if (pos == AnsiString::npos) return "";
//else return newPath.substr(0, pos + 1);
}
//////////////////////////////////////////////////////////////////////////
-AnsiString PathUtil::GetFileName(const AnsiString &path) {
- AnsiString newPath = UnifySeparators(path);
+AnsiString PathUtil::getFileName(const AnsiString &path) {
+ AnsiString newPath = unifySeparators(path);
//size_t pos = newPath.find_last_of(L'/'); TODO REMOVE.
Common::String lastPart = Common::lastPathComponent(path, '/');
@@ -88,8 +88,8 @@ AnsiString PathUtil::GetFileName(const AnsiString &path) {
}
//////////////////////////////////////////////////////////////////////////
-AnsiString PathUtil::GetFileNameWithoutExtension(const AnsiString &path) {
- AnsiString fileName = GetFileName(path);
+AnsiString PathUtil::getFileNameWithoutExtension(const AnsiString &path) {
+ AnsiString fileName = getFileName(path);
//size_t pos = fileName.find_last_of('.'); //TODO REMOVE!
// TODO: Prettify this.
@@ -101,8 +101,8 @@ AnsiString PathUtil::GetFileNameWithoutExtension(const AnsiString &path) {
}
//////////////////////////////////////////////////////////////////////////
-AnsiString PathUtil::GetExtension(const AnsiString &path) {
- AnsiString fileName = GetFileName(path);
+AnsiString PathUtil::getExtension(const AnsiString &path) {
+ AnsiString fileName = getFileName(path);
//size_t pos = fileName.find_last_of('.');
return Common::lastPathComponent(path, '.');
@@ -112,8 +112,8 @@ AnsiString PathUtil::GetExtension(const AnsiString &path) {
//////////////////////////////////////////////////////////////////////////
-AnsiString PathUtil::GetSafeLogFileName() {
- AnsiString logFileName = GetUserDirectory();
+AnsiString PathUtil::getSafeLogFileName() {
+ AnsiString logFileName = getUserDirectory();
#ifdef __WIN32__
char moduleName[MAX_PATH];
@@ -125,25 +125,25 @@ AnsiString PathUtil::GetSafeLogFileName() {
#else
// !PORTME
- logFileName = Combine(logFileName, "/Wintermute Engine/wme.log");
+ logFileName = combine(logFileName, "/Wintermute Engine/wme.log");
#endif
- CreateDirectory(GetDirectoryName(logFileName));
+ createDirectory(getDirectoryName(logFileName));
return logFileName;
}
//////////////////////////////////////////////////////////////////////////
-bool PathUtil::CreateDirectory(const AnsiString &path) {
+bool PathUtil::createDirectory(const AnsiString &path) {
return false;
}
//////////////////////////////////////////////////////////////////////////
-bool PathUtil::MatchesMask(const AnsiString &fileName, const AnsiString &mask) {
+bool PathUtil::matchesMask(const AnsiString &fileName, const AnsiString &mask) {
return false;
}
//////////////////////////////////////////////////////////////////////////
-bool PathUtil::FileExists(const AnsiString &fileName) {
+bool PathUtil::fileExists(const AnsiString &fileName) {
warning("PathUtil::FileExists(%s)", fileName.c_str());
Common::File stream;
@@ -157,7 +157,7 @@ bool PathUtil::FileExists(const AnsiString &fileName) {
//////////////////////////////////////////////////////////////////////////
-AnsiString PathUtil::GetUserDirectory() {
+AnsiString PathUtil::getUserDirectory() {
warning("PathUtil::GetUserDirectory - stubbed");
AnsiString userDir = "./";
#if 0
diff --git a/engines/wintermute/utils/PathUtil.h b/engines/wintermute/utils/PathUtil.h
index 0bc883a1fa..13e9e46652 100644
--- a/engines/wintermute/utils/PathUtil.h
+++ b/engines/wintermute/utils/PathUtil.h
@@ -35,20 +35,20 @@ namespace WinterMute {
class PathUtil {
public:
- static AnsiString UnifySeparators(const AnsiString &path);
- static AnsiString NormalizeFileName(const AnsiString &path);
- static AnsiString Combine(const AnsiString &path1, const AnsiString &path2);
- static AnsiString GetDirectoryName(const AnsiString &path);
- static AnsiString GetFileName(const AnsiString &path);
- static AnsiString GetFileNameWithoutExtension(const AnsiString &path);
- static AnsiString GetExtension(const AnsiString &path);
- static bool CreateDirectory(const AnsiString &path);
- static bool MatchesMask(const AnsiString &fileName, const AnsiString &mask);
-
- static bool FileExists(const AnsiString &fileName);
-
- static AnsiString GetSafeLogFileName();
- static AnsiString GetUserDirectory();
+ static AnsiString unifySeparators(const AnsiString &path);
+ static AnsiString normalizeFileName(const AnsiString &path);
+ static AnsiString combine(const AnsiString &path1, const AnsiString &path2);
+ static AnsiString getDirectoryName(const AnsiString &path);
+ static AnsiString getFileName(const AnsiString &path);
+ static AnsiString getFileNameWithoutExtension(const AnsiString &path);
+ static AnsiString getExtension(const AnsiString &path);
+ static bool createDirectory(const AnsiString &path);
+ static bool matchesMask(const AnsiString &fileName, const AnsiString &mask);
+
+ static bool fileExists(const AnsiString &fileName);
+
+ static AnsiString getSafeLogFileName();
+ static AnsiString getUserDirectory();
};
} // end of namespace WinterMute
diff --git a/engines/wintermute/utils/StringUtil.cpp b/engines/wintermute/utils/StringUtil.cpp
index 2ca392973b..53ad4c8add 100644
--- a/engines/wintermute/utils/StringUtil.cpp
+++ b/engines/wintermute/utils/StringUtil.cpp
@@ -34,32 +34,32 @@
namespace WinterMute {
//////////////////////////////////////////////////////////////////////////
-void StringUtil::ToLowerCase(AnsiString &str) {
+void StringUtil::toLowerCase(AnsiString &str) {
str.toLowercase();
}
//////////////////////////////////////////////////////////////////////////
-/*void StringUtil::ToLowerCase(WideString &str) {
+/*void StringUtil::toLowerCase(WideString &str) {
std::transform(str.begin(), str.end(), str.begin(), ::towlower);
}*/
//////////////////////////////////////////////////////////////////////////
-void StringUtil::ToUpperCase(AnsiString &str) {
+void StringUtil::toUpperCase(AnsiString &str) {
str.toUppercase();
}
//////////////////////////////////////////////////////////////////////////
-/*void StringUtil::ToUpperCase(WideString &str) {
+/*void StringUtil::toUpperCase(WideString &str) {
std::transform(str.begin(), str.end(), str.begin(), ::towupper);
}*/
//////////////////////////////////////////////////////////////////////////
-bool StringUtil::CompareNoCase(const AnsiString &str1, const AnsiString &str2) {
+bool StringUtil::compareNoCase(const AnsiString &str1, const AnsiString &str2) {
AnsiString str1lc = str1;
AnsiString str2lc = str2;
- ToLowerCase(str1lc);
- ToLowerCase(str2lc);
+ toLowerCase(str1lc);
+ toLowerCase(str2lc);
return (str1lc == str2lc);
}
@@ -76,7 +76,7 @@ bool StringUtil::CompareNoCase(const AnsiString &str1, const AnsiString &str2) {
}*/
//////////////////////////////////////////////////////////////////////////
-WideString StringUtil::Utf8ToWide(const Utf8String &Utf8Str) {
+WideString StringUtil::utf8ToWide(const Utf8String &Utf8Str) {
error("StringUtil::Utf8ToWide - WideString not supported yet");
/* size_t WideSize = Utf8Str.size();
@@ -125,8 +125,8 @@ WideString StringUtil::Utf8ToWide(const Utf8String &Utf8Str) {
}
//////////////////////////////////////////////////////////////////////////
-Utf8String StringUtil::WideToUtf8(const WideString &WideStr) {
- error("StringUtil::WideToUtf8 - Widestring not supported yet");
+Utf8String StringUtil::wideToUtf8(const WideString &WideStr) {
+ error("StringUtil::wideToUtf8 - Widestring not supported yet");
/* size_t WideSize = WideStr.length();
if (sizeof(wchar_t) == 2) {
@@ -187,7 +187,7 @@ char simpleAnsiToWide(const AnsiString &str, uint32 &offset) {
}
//////////////////////////////////////////////////////////////////////////
-WideString StringUtil::AnsiToWide(const AnsiString &str) {
+WideString StringUtil::ansiToWide(const AnsiString &str) {
// TODO: This function gets called a lot, so warnings like these drown out the usefull information
static bool hasWarned = false;
if (!hasWarned) {
@@ -212,7 +212,7 @@ WideString StringUtil::AnsiToWide(const AnsiString &str) {
}
//////////////////////////////////////////////////////////////////////////
-AnsiString StringUtil::WideToAnsi(const WideString &wstr) {
+AnsiString StringUtil::wideToAnsi(const WideString &wstr) {
// using default os locale!
// TODO: This function gets called a lot, so warnings like these drown out the usefull information
static bool hasWarned = false;
@@ -231,7 +231,7 @@ AnsiString StringUtil::WideToAnsi(const WideString &wstr) {
}
//////////////////////////////////////////////////////////////////////////
-bool StringUtil::StartsWith(const AnsiString &str, const AnsiString &pattern, bool ignoreCase) {
+bool StringUtil::startsWith(const AnsiString &str, const AnsiString &pattern, bool ignoreCase) {
/* size_t strLength = str.size();
size_t patternLength = pattern.size();
@@ -258,7 +258,7 @@ bool StringUtil::StartsWith(const AnsiString &str, const AnsiString &pattern, bo
}
//////////////////////////////////////////////////////////////////////////
-bool StringUtil::EndsWith(const AnsiString &str, const AnsiString &pattern, bool ignoreCase) {
+bool StringUtil::endsWith(const AnsiString &str, const AnsiString &pattern, bool ignoreCase) {
/* size_t strLength = str.size(); // TODO: Remove
size_t patternLength = pattern.size();
@@ -285,13 +285,13 @@ bool StringUtil::EndsWith(const AnsiString &str, const AnsiString &pattern, bool
}
//////////////////////////////////////////////////////////////////////////
-bool StringUtil::IsUtf8BOM(const byte *Buffer, uint32 BufferSize) {
+bool StringUtil::isUtf8BOM(const byte *Buffer, uint32 BufferSize) {
if (BufferSize > 3 && Buffer[0] == 0xEF && Buffer[1] == 0xBB && Buffer[2] == 0xBF) return true;
else return false;
}
//////////////////////////////////////////////////////////////////////////
-AnsiString StringUtil::Replace(const AnsiString &str, const AnsiString &from, const AnsiString &to) {
+AnsiString StringUtil::replace(const AnsiString &str, const AnsiString &from, const AnsiString &to) {
if (from.empty() || from == to) return str;
AnsiString result = str;
@@ -317,7 +317,7 @@ AnsiString StringUtil::Replace(const AnsiString &str, const AnsiString &from, co
}
//////////////////////////////////////////////////////////////////////////
-AnsiString StringUtil::Trim(const AnsiString &str, bool fromLeft, bool fromRight, const AnsiString &chars) {
+AnsiString StringUtil::trim(const AnsiString &str, bool fromLeft, bool fromRight, const AnsiString &chars) {
AnsiString trimmedStr = str;
if (fromRight) {
@@ -325,7 +325,7 @@ AnsiString StringUtil::Trim(const AnsiString &str, bool fromLeft, bool fromRight
warning("fromRight-trim not implemented yet, %s", chars.c_str());
}
if (fromLeft) {
- uint32 lastOf = LastIndexOf(str, chars, 0);
+ uint32 lastOf = lastIndexOf(str, chars, 0);
trimmedStr = Common::String(trimmedStr.c_str() + lastOf);
//trimmedStr.erase(0, trimmedStr.find_first_not_of(chars));
}
@@ -333,7 +333,7 @@ AnsiString StringUtil::Trim(const AnsiString &str, bool fromLeft, bool fromRight
}
//////////////////////////////////////////////////////////////////////////
-int StringUtil::IndexOf(const WideString &str, const WideString &toFind, size_t startFrom) {
+int StringUtil::indexOf(const WideString &str, const WideString &toFind, size_t startFrom) {
/*size_t pos = str.find(toFind, startFrom);
if (pos == str.npos) return -1;
else return pos;*/
@@ -345,7 +345,7 @@ int StringUtil::IndexOf(const WideString &str, const WideString &toFind, size_t
}
//////////////////////////////////////////////////////////////////////////
-int StringUtil::LastIndexOf(const WideString &str, const WideString &toFind, size_t startFrom) {
+int StringUtil::lastIndexOf(const WideString &str, const WideString &toFind, size_t startFrom) {
/*size_t pos = str.rfind(toFind, startFrom);
if (pos == str.npos) return -1;
else return pos;*/
@@ -368,7 +368,7 @@ int StringUtil::LastIndexOf(const WideString &str, const WideString &toFind, siz
}
//////////////////////////////////////////////////////////////////////////
-AnsiString StringUtil::ToString(size_t val) {
+AnsiString StringUtil::toString(size_t val) {
/* std::ostringstream str;
str << val;
return str.str();*/
@@ -376,7 +376,7 @@ AnsiString StringUtil::ToString(size_t val) {
}
//////////////////////////////////////////////////////////////////////////
-AnsiString StringUtil::ToString(int val) {
+AnsiString StringUtil::toString(int val) {
/* std::ostringstream str;
str << val;
return str.str();*/
@@ -384,7 +384,7 @@ AnsiString StringUtil::ToString(int val) {
}
//////////////////////////////////////////////////////////////////////////
-AnsiString StringUtil::ToString(float val) {
+AnsiString StringUtil::toString(float val) {
/* std::ostringstream str;
str << val;
return str.str();*/
@@ -392,7 +392,7 @@ AnsiString StringUtil::ToString(float val) {
}
//////////////////////////////////////////////////////////////////////////
-AnsiString StringUtil::ToString(double val) {
+AnsiString StringUtil::toString(double val) {
/* std::ostringstream str;
str << val;
return str.str();*/
@@ -401,7 +401,7 @@ AnsiString StringUtil::ToString(double val) {
//////////////////////////////////////////////////////////////////////////
-void StringUtil::Split(const AnsiString &list, const AnsiString &delimiters, AnsiStringArray &result, bool keepEmptyItems) {
+void StringUtil::split(const AnsiString &list, const AnsiString &delimiters, AnsiStringArray &result, bool keepEmptyItems) {
result.clear();
//TODO: Verify this, wrt keepEmptyItems.
Common::StringTokenizer tokenizer(list.c_str(), delimiters.c_str());
diff --git a/engines/wintermute/utils/StringUtil.h b/engines/wintermute/utils/StringUtil.h
index a4727fabbe..e06551b09a 100644
--- a/engines/wintermute/utils/StringUtil.h
+++ b/engines/wintermute/utils/StringUtil.h
@@ -35,34 +35,34 @@ namespace WinterMute {
class StringUtil {
public:
- static void ToLowerCase(AnsiString &str);
- //static void ToLowerCase(WideString &str);
- static void ToUpperCase(AnsiString &str);
- //static void ToUpperCase(WideString &str);
- static bool CompareNoCase(const AnsiString &str1, const AnsiString &str2);
- //static bool CompareNoCase(const WideString &str1, const WideString &str2);
- static WideString Utf8ToWide(const Utf8String &Utf8Str);
- static Utf8String WideToUtf8(const WideString &WideStr);
- static WideString AnsiToWide(const AnsiString &str);
- static AnsiString WideToAnsi(const WideString &str);
+ static void toLowerCase(AnsiString &str);
+ //static void toLowerCase(WideString &str);
+ static void toUpperCase(AnsiString &str);
+ //static void toUpperCase(WideString &str);
+ static bool compareNoCase(const AnsiString &str1, const AnsiString &str2);
+ //static bool compareNoCase(const WideString &str1, const WideString &str2);
+ static WideString utf8ToWide(const Utf8String &Utf8Str);
+ static Utf8String wideToUtf8(const WideString &WideStr);
+ static WideString ansiToWide(const AnsiString &str);
+ static AnsiString wideToAnsi(const WideString &str);
- static bool StartsWith(const AnsiString &str, const AnsiString &pattern, bool ignoreCase = false);
- static bool EndsWith(const AnsiString &str, const AnsiString &pattern, bool ignoreCase = false);
+ static bool startsWith(const AnsiString &str, const AnsiString &pattern, bool ignoreCase = false);
+ static bool endsWith(const AnsiString &str, const AnsiString &pattern, bool ignoreCase = false);
- static bool IsUtf8BOM(const byte *buffer, uint32 bufferSize);
+ static bool isUtf8BOM(const byte *buffer, uint32 bufferSize);
- static AnsiString Replace(const AnsiString &str, const AnsiString &from, const AnsiString &to);
- static AnsiString Trim(const AnsiString &str, bool fromLeft = true, bool fromRight = true, const AnsiString &chars = " \n\r\t");
+ static AnsiString replace(const AnsiString &str, const AnsiString &from, const AnsiString &to);
+ static AnsiString trim(const AnsiString &str, bool fromLeft = true, bool fromRight = true, const AnsiString &chars = " \n\r\t");
- static int IndexOf(const WideString &str, const WideString &toFind, size_t startFrom);
- static int LastIndexOf(const WideString &str, const WideString &toFind, size_t startFrom);
+ static int indexOf(const WideString &str, const WideString &toFind, size_t startFrom);
+ static int lastIndexOf(const WideString &str, const WideString &toFind, size_t startFrom);
- static AnsiString ToString(size_t val);
- static AnsiString ToString(int val);
- static AnsiString ToString(float val);
- static AnsiString ToString(double val);
+ static AnsiString toString(size_t val);
+ static AnsiString toString(int val);
+ static AnsiString toString(float val);
+ static AnsiString toString(double val);
- static void Split(const AnsiString &list, const AnsiString &delimiters, AnsiStringArray &result, bool keepEmptyItems = false);
+ static void split(const AnsiString &list, const AnsiString &delimiters, AnsiStringArray &result, bool keepEmptyItems = false);
};
} // end of namespace WinterMute
diff --git a/engines/wintermute/utils/utils.cpp b/engines/wintermute/utils/utils.cpp
index 2f66313bb0..ae456b25e7 100644
--- a/engines/wintermute/utils/utils.cpp
+++ b/engines/wintermute/utils/utils.cpp
@@ -101,7 +101,7 @@ float CBUtils::NormalizeAngle(float Angle) {
void CBUtils::CreatePath(const char *Path, bool PathOnly) {
AnsiString path;
- if (!PathOnly) path = PathUtil::GetDirectoryName(Path);
+ if (!PathOnly) path = PathUtil::getDirectoryName(Path);
else path = Path;
// try {
@@ -237,7 +237,7 @@ bool CBUtils::MatchesPattern(const char *Pattern, const char *String) {
//////////////////////////////////////////////////////////////////////////
char *CBUtils::GetPath(const char *Filename) {
- AnsiString path = PathUtil::GetDirectoryName(Filename);
+ AnsiString path = PathUtil::getDirectoryName(Filename);
//path = boost::filesystem::syste_complete(path).string();
warning("CBUtils::GetPath: (%s), not implemented", Filename);
char *ret = new char[path.size() + 1];
@@ -248,7 +248,7 @@ char *CBUtils::GetPath(const char *Filename) {
//////////////////////////////////////////////////////////////////////////
char *CBUtils::GetFilename(const char *Filename) {
- AnsiString path = PathUtil::GetFileName(Filename);
+ AnsiString path = PathUtil::getFileName(Filename);
char *ret = new char[path.size() + 1];
strcpy(ret, path.c_str());
return ret;