[Scummvm-cvs-logs] SF.net SVN: scummvm:[54255] scummvm/trunk/gui

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Tue Nov 16 00:51:47 CET 2010


Revision: 54255
          http://scummvm.svn.sourceforge.net/scummvm/?rev=54255&view=rev
Author:   fingolfin
Date:     2010-11-15 23:51:46 +0000 (Mon, 15 Nov 2010)

Log Message:
-----------
GUI: Tweak ThemeEngine methods to use Common::String params & const qualifier

Modified Paths:
--------------
    scummvm/trunk/gui/ThemeEngine.cpp
    scummvm/trunk/gui/ThemeEngine.h

Modified: scummvm/trunk/gui/ThemeEngine.cpp
===================================================================
--- scummvm/trunk/gui/ThemeEngine.cpp	2010-11-15 21:47:45 UTC (rev 54254)
+++ scummvm/trunk/gui/ThemeEngine.cpp	2010-11-15 23:51:46 UTC (rev 54255)
@@ -566,7 +566,7 @@
 	if (file == "default") {
 		_texts[textId]->_fontPtr = _font;
 	} else {
-		Common::String localized = genLocalizedFontFilename(file.c_str());
+		Common::String localized = genLocalizedFontFilename(file);
 		// Try built-in fonts
 		_texts[textId]->_fontPtr = FontMan.getFontByName(localized);
 
@@ -1420,7 +1420,7 @@
 
 const Graphics::Font *ThemeEngine::loadFont(const Common::String &filename) {
 	const Graphics::Font *font = 0;
-	Common::String cacheFilename = genCacheFilename(filename.c_str());
+	Common::String cacheFilename = genCacheFilename(filename);
 	Common::File fontFile;
 
 	if (!cacheFilename.empty()) {
@@ -1455,7 +1455,7 @@
 	return font;
 }
 
-Common::String ThemeEngine::genCacheFilename(const char *filename) {
+Common::String ThemeEngine::genCacheFilename(const Common::String &filename) const {
 	Common::String cacheName(filename);
 	for (int i = cacheName.size() - 1; i >= 0; --i) {
 		if (cacheName[i] == '.') {
@@ -1471,25 +1471,20 @@
 	return Common::String();
 }
 
-Common::String ThemeEngine::genLocalizedFontFilename(const char *filename) {
+Common::String ThemeEngine::genLocalizedFontFilename(const Common::String &filename) const {
 #ifndef USE_TRANSLATION
-	return Common::String(filename);
+	return filename;
 #else
-
 	Common::String result;
 	bool pointPassed = false;
 
-	for (const char *p = filename; *p != 0; p++) {
-		if (!pointPassed) {
-			if (*p != '.') {
-				result += *p;
-			} else {
-				result += "-";
-				result += TransMan.getCurrentCharset();
-				result += *p;
+	for (const char *p = filename.c_str(); *p != 0; p++) {
+		if (!pointPassed && *p == '.') {
+			result += "-";
+			result += TransMan.getCurrentCharset();
+			result += *p;
 
-				pointPassed = true;
-			}
+			pointPassed = true;
 		} else {
 			result += *p;
 		}

Modified: scummvm/trunk/gui/ThemeEngine.h
===================================================================
--- scummvm/trunk/gui/ThemeEngine.h	2010-11-15 21:47:45 UTC (rev 54254)
+++ scummvm/trunk/gui/ThemeEngine.h	2010-11-15 23:51:46 UTC (rev 54255)
@@ -531,8 +531,8 @@
 	const Graphics::Font *loadFont(const Common::String &filename);
 	const Graphics::Font *loadFontFromArchive(const Common::String &filename);
 	const Graphics::Font *loadCachedFontFromArchive(const Common::String &filename);
-	Common::String genCacheFilename(const char *filename);
-	Common::String genLocalizedFontFilename(const char *filename);
+	Common::String genCacheFilename(const Common::String &filename) const;
+	Common::String genLocalizedFontFilename(const Common::String &filename) const;
 
 	/**
 	 *	Actual Dirty Screen handling function.


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list