diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-11-09 23:05:44 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-11-09 23:05:44 +0000 |
commit | 38424c9b5d464d262aa05adfc899285f86b43275 (patch) | |
tree | 038aca539bb270928732e80d278be7b3f958df22 | |
parent | 9819ef7742cc2e3af92a0b760fa33e30218ff7bb (diff) |
Add StringSwitch::Cases overloads, for matching multiple strings to a single
value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86618 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/ADT/StringSwitch.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/include/llvm/ADT/StringSwitch.h b/include/llvm/ADT/StringSwitch.h index 48a52de9d1..d9f69b215a 100644 --- a/include/llvm/ADT/StringSwitch.h +++ b/include/llvm/ADT/StringSwitch.h @@ -65,6 +65,25 @@ public: return *this; } + template<unsigned N0, unsigned N1> + StringSwitch& Cases(const char (&S0)[N0], const char (&S1)[N1], + const T& Value) { + return Case(S0, Value).Case(S1, Value); + } + + template<unsigned N0, unsigned N1, unsigned N2> + StringSwitch& Cases(const char (&S0)[N0], const char (&S1)[N1], + const char (&S2)[N2], const T& Value) { + return Case(S0, Value).Case(S1, Value).Case(S2, Value); + } + + template<unsigned N0, unsigned N1, unsigned N2, unsigned N3> + StringSwitch& Cases(const char (&S0)[N0], const char (&S1)[N1], + const char (&S2)[N2], const char (&S3)[N3], + const T& Value) { + return Case(S0, Value).Case(S1, Value).Case(S2, Value).Case(S3, Value); + } + T Default(const T& Value) { if (ResultKnown) return Result; |