StringSwitch.h (208954) | StringSwitch.h (212904) |
---|---|
1//===--- StringSwitch.h - Switch-on-literal-string Construct --------------===/ 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7//===----------------------------------------------------------------------===/ 8// --- 47 unchanged lines hidden (view full) --- 56 if (!Result && N-1 == Str.size() && 57 (std::memcmp(S, Str.data(), N-1) == 0)) { 58 Result = &Value; 59 } 60 61 return *this; 62 } 63 | 1//===--- StringSwitch.h - Switch-on-literal-string Construct --------------===/ 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7//===----------------------------------------------------------------------===/ 8// --- 47 unchanged lines hidden (view full) --- 56 if (!Result && N-1 == Str.size() && 57 (std::memcmp(S, Str.data(), N-1) == 0)) { 58 Result = &Value; 59 } 60 61 return *this; 62 } 63 |
64 template<unsigned N> 65 StringSwitch& EndsWith(const char (&S)[N], const T &Value) { 66 if (!Result && Str.size() >= N-1 && 67 std::memcmp(S, Str.data() + Str.size() + 1 - N, N-1) == 0) { 68 Result = &Value; 69 } 70 71 return *this; 72 } 73 74 template<unsigned N> 75 StringSwitch& StartsWith(const char (&S)[N], const T &Value) { 76 if (!Result && Str.size() >= N-1 && 77 std::memcmp(S, Str.data(), N-1) == 0) { 78 Result = &Value; 79 } 80 81 return *this; 82 } 83 |
|
64 template<unsigned N0, unsigned N1> 65 StringSwitch& Cases(const char (&S0)[N0], const char (&S1)[N1], 66 const T& Value) { 67 return Case(S0, Value).Case(S1, Value); 68 } 69 70 template<unsigned N0, unsigned N1, unsigned N2> 71 StringSwitch& Cases(const char (&S0)[N0], const char (&S1)[N1], --- 35 unchanged lines hidden --- | 84 template<unsigned N0, unsigned N1> 85 StringSwitch& Cases(const char (&S0)[N0], const char (&S1)[N1], 86 const T& Value) { 87 return Case(S0, Value).Case(S1, Value); 88 } 89 90 template<unsigned N0, unsigned N1, unsigned N2> 91 StringSwitch& Cases(const char (&S0)[N0], const char (&S1)[N1], --- 35 unchanged lines hidden --- |