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 | 2bda47cbac6778a204037890479611a1631a480f (patch) | |
tree | 2ccda71201286ccc11205bdfe19f08cba90975f3 /lexlib/CharacterSet.h | |
parent | 8822e0ed1db342bf1947004c660a9c8649ce35c0 (diff) | |
download | scintilla-mirror-2bda47cbac6778a204037890479611a1631a480f.tar.gz |
Backport: Templatize MakeUpperCase/MakeLowerCase so they work on char/int without casts.
Backport of changeset 6707:29e80e764b46.
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 |