aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2010-03-18 15:07:48 +0000
committerMax Horn2010-03-18 15:07:48 +0000
commit30c84d2cff41924e6229d0cacd3d36ce1c2bf6ac (patch)
treece3e0d505397e350e7fc87be8337b1c696991fcd
parent3e63df54152c278ea28b430875c82b00d2109967 (diff)
downloadscummvm-rg350-30c84d2cff41924e6229d0cacd3d36ce1c2bf6ac.tar.gz
scummvm-rg350-30c84d2cff41924e6229d0cacd3d36ce1c2bf6ac.tar.bz2
scummvm-rg350-30c84d2cff41924e6229d0cacd3d36ce1c2bf6ac.zip
COMMON: Move tag2str from util.h to str.h
svn-id: r48281
-rw-r--r--common/str.cpp15
-rw-r--r--common/str.h20
-rw-r--r--common/util.cpp19
-rw-r--r--common/util.h9
4 files changed, 39 insertions, 24 deletions
diff --git a/common/str.cpp b/common/str.cpp
index 3517315e95..56ef39cb82 100644
--- a/common/str.cpp
+++ b/common/str.cpp
@@ -724,4 +724,19 @@ bool matchString(const char *str, const char *pat, bool ignoreCase, bool pathMod
}
}
+String tag2string(uint32 tag) {
+ char str[5];
+ str[0] = (char)(tag >> 24);
+ str[1] = (char)(tag >> 16);
+ str[2] = (char)(tag >> 8);
+ str[3] = (char)tag;
+ str[4] = '\0';
+ // Replace non-printable chars by dot
+ for (int i = 0; i < 4; ++i) {
+ if (!isprint((unsigned char)str[i]))
+ str[i] = '.';
+ }
+ return Common::String(str);
+}
+
} // End of namespace Common
diff --git a/common/str.h b/common/str.h
index de0f37cd62..829348a870 100644
--- a/common/str.h
+++ b/common/str.h
@@ -319,8 +319,28 @@ Common::String normalizePath(const Common::String &path, const char sep);
bool matchString(const char *str, const char *pat, bool ignoreCase = false, bool pathMode = false);
+/**
+ * A 'list' of strings. Actually, this is nowadays an array, and hence misnamed.
+ */
typedef Array<String> StringList;
+
+
+/**
+ * Take a 32 bit value and turn it into a four character string, where each of
+ * the four bytes is turned into one character. Most significant byte is printed
+ * first.
+ */
+String tag2string(uint32 tag);
+
+/**
+ * Convenience wrapper for tag2string which "returns" a C string.
+ * Note: It is *NOT* safe to do anything with the return value other than directly
+ * copying or printing it.
+ */
+#define tag2str(x) Common::tag2string(x).c_str()
+
+
} // End of namespace Common
#endif
diff --git a/common/util.cpp b/common/util.cpp
index 6ab9f9d7d4..f04b403e19 100644
--- a/common/util.cpp
+++ b/common/util.cpp
@@ -59,6 +59,10 @@ String StringTokenizer::nextToken() {
return String(_str.c_str() + _tokenBegin, _tokenEnd - _tokenBegin);
}
+
+#pragma mark -
+
+
//
// Print hexdump of the data passed in
//
@@ -111,21 +115,6 @@ void hexdump(const byte * data, int len, int bytesPerLine, int startOffset) {
printf("|\n");
}
-String tag2string(uint32 tag) {
- char str[5];
- str[0] = (char)(tag >> 24);
- str[1] = (char)(tag >> 16);
- str[2] = (char)(tag >> 8);
- str[3] = (char)tag;
- str[4] = '\0';
- // Replace non-printable chars by dot
- for (int i = 0; i < 4; ++i) {
- if (!isprint((unsigned char)str[i]))
- str[i] = '.';
- }
- return Common::String(str);
-}
-
#pragma mark -
diff --git a/common/util.h b/common/util.h
index 3e1fc2d1c1..e5d2f91b32 100644
--- a/common/util.h
+++ b/common/util.h
@@ -103,15 +103,6 @@ extern void hexdump(const byte * data, int len, int bytesPerLine = 16, int start
/**
- * Take a 32 bit value and turn it into a four character string, where each of
- * the four bytes is turned into one character. Most significant byte is printed
- * first.
- */
-String tag2string(uint32 tag);
-#define tag2str(x) Common::tag2string(x).c_str()
-
-
-/**
* List of game language.
*/
enum Language {