changeset 15077:670ce3cdb193 draft

(svn r19703) -Add: hexadecimal string filter
author rubidium <rubidium@openttd.org>
date Sat, 24 Apr 2010 07:31:58 +0000
parents 8587c4a3ee44
children 9447ea559549
files src/string.cpp src/string_type.h
diffstat 2 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/string.cpp
+++ b/src/string.cpp
@@ -202,6 +202,7 @@
 		case CS_NUMERAL:       return (key >= '0' && key <= '9');
 		case CS_NUMERAL_SPACE: return (key >= '0' && key <= '9') || key == ' ';
 		case CS_ALPHA:         return IsPrintable(key) && !(key >= '0' && key <= '9');
+		case CS_HEXADECIMAL:   return (key >= '0' && key <= '9') || (key >= 'a' && key <= 'f') || (key >= 'A' && key <= 'F');
 	}
 
 	return false;
--- a/src/string_type.h
+++ b/src/string_type.h
@@ -20,6 +20,7 @@
 	CS_NUMERAL,           ///< Only numeric ones
 	CS_NUMERAL_SPACE,     ///< Only numbers and spaces
 	CS_ALPHA,             ///< Only alphabetic values
+	CS_HEXADECIMAL,       ///< Only hexadecimal characters
 };
 
 typedef uint32 WChar;