diff options
author | Neil <nyamatongwe@gmail.com> | 2018-04-19 22:49:44 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2018-04-19 22:49:44 +1000 |
commit | a8fed0f50f5ef7540102b03975ac4c68bc737e66 (patch) | |
tree | a438b588704daa03f5e30a8e06d83b3044191e6c /lexlib/CharacterSet.h | |
parent | c4025b67d3afa0de81d6f6360a8d7a49bf1406c9 (diff) | |
download | scintilla-mirror-a8fed0f50f5ef7540102b03975ac4c68bc737e66.tar.gz |
Templatize MakeUpperCase/MakeLowerCase so they work on char/int without casts.
Diffstat (limited to 'lexlib/CharacterSet.h')
-rw-r--r-- | lexlib/CharacterSet.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lexlib/CharacterSet.h b/lexlib/CharacterSet.h index be906ceaa..5965f38ca 100644 --- a/lexlib/CharacterSet.h +++ b/lexlib/CharacterSet.h @@ -167,16 +167,18 @@ inline bool isoperator(int ch) { return false; } -// Simple case functions for ASCII. +// Simple case functions for ASCII supersets. -inline int MakeUpperCase(int ch) { +template <typename T> +inline T MakeUpperCase(T ch) { if (ch < 'a' || ch > 'z') return ch; else - return static_cast<char>(ch - 'a' + 'A'); + return ch - 'a' + 'A'; } -inline int MakeLowerCase(int ch) { +template <typename T> +inline T MakeLowerCase(T ch) { if (ch < 'A' || ch > 'Z') return ch; else |