aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorCameron Cawley2019-07-24 15:15:57 +0100
committerFilippos Karapetis2019-07-24 22:47:40 +0300
commit30edabf589953d701db118bf7085e372755c8c75 (patch)
tree3cea5ee3c4f6918837b12a68ebc17d95a94387c5 /common
parentd1e0c91bd039de62074fde7ca197f1e66feb06ec (diff)
downloadscummvm-rg350-30edabf589953d701db118bf7085e372755c8c75.tar.gz
scummvm-rg350-30edabf589953d701db118bf7085e372755c8c75.tar.bz2
scummvm-rg350-30edabf589953d701db118bf7085e372755c8c75.zip
COMMON: Add wrappers for iscntrl() and isgraph()
Diffstat (limited to 'common')
-rw-r--r--common/util.cpp22
-rw-r--r--common/util.h19
2 files changed, 28 insertions, 13 deletions
diff --git a/common/util.cpp b/common/util.cpp
index a6c7958a0d..9a4214eda8 100644
--- a/common/util.cpp
+++ b/common/util.cpp
@@ -20,17 +20,7 @@
*
*/
-#define FORBIDDEN_SYMBOL_EXCEPTION_isalnum
-#define FORBIDDEN_SYMBOL_EXCEPTION_isalpha
-#define FORBIDDEN_SYMBOL_EXCEPTION_isdigit
-#define FORBIDDEN_SYMBOL_EXCEPTION_isxdigit
-#define FORBIDDEN_SYMBOL_EXCEPTION_isnumber
-#define FORBIDDEN_SYMBOL_EXCEPTION_islower
-#define FORBIDDEN_SYMBOL_EXCEPTION_isspace
-#define FORBIDDEN_SYMBOL_EXCEPTION_isupper
-#define FORBIDDEN_SYMBOL_EXCEPTION_isprint
-#define FORBIDDEN_SYMBOL_EXCEPTION_ispunct
-
+#define FORBIDDEN_SYMBOL_EXCEPTION_ctype_h
#include "common/util.h"
#include "common/debug.h"
@@ -163,4 +153,14 @@ bool isPunct(int c) {
return ispunct((byte)c);
}
+bool isCntrl(int c) {
+ ENSURE_ASCII_CHAR(c);
+ return iscntrl((byte)c);
+}
+
+bool isGraph(int c) {
+ ENSURE_ASCII_CHAR(c);
+ return isgraph((byte)c);
+}
+
} // End of namespace Common
diff --git a/common/util.h b/common/util.h
index 5f853da43a..a90ea72167 100644
--- a/common/util.h
+++ b/common/util.h
@@ -195,16 +195,31 @@ bool isUpper(int c);
*/
bool isPrint(int c);
-
/**
* Test whether the given character is a punctuation character,
- * (i.e not alphanumeric.
+ * (i.e. not alphanumeric).
*
* @param c the character to test
* @return true if the character is punctuation, false otherwise.
*/
bool isPunct(int c);
+/**
+ * Test whether the given character is a control character.
+ *
+ * @param c the character to test
+ * @return true if the character is a control character, false otherwise.
+ */
+bool isCntrl(int c);
+
+/**
+ * Test whether the given character has a graphical representation.
+ *
+ * @param c the character to test
+ * @return true if the character is a graphic, false otherwise.
+ */
+bool isGraph(int c);
+
} // End of namespace Common
#endif