LLVM API Documentation
A switch()-like statement whose cases are string literals. More...
#include <StringSwitch.h>
Public Member Functions | |
StringSwitch (StringRef S) | |
template<unsigned N> | |
StringSwitch & | Case (const char(&S)[N], const T &Value) |
template<unsigned N> | |
StringSwitch & | EndsWith (const char(&S)[N], const T &Value) |
template<unsigned N> | |
StringSwitch & | StartsWith (const char(&S)[N], const T &Value) |
template<unsigned N0, unsigned N1> | |
StringSwitch & | Cases (const char(&S0)[N0], const char(&S1)[N1], const T &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) |
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) |
template<unsigned N0, unsigned N1, unsigned N2, unsigned N3, unsigned N4> | |
StringSwitch & | Cases (const char(&S0)[N0], const char(&S1)[N1], const char(&S2)[N2], const char(&S3)[N3], const char(&S4)[N4], const T &Value) |
R | Default (const T &Value) const |
operator R () const | |
A switch()-like statement whose cases are string literals.
The StringSwitch class is a simple form of a switch() statement that determines whether the given string matches one of the given string literals. The template type parameter T
is the type of the value that will be returned from the string-switch expression. For example, the following code switches on the name of a color in argv
[i]:
Definition at line 42 of file StringSwitch.h.
|
inlineexplicit |
Definition at line 51 of file StringSwitch.h.
|
inline |
Definition at line 55 of file StringSwitch.h.
References llvm::StringRef::data(), llvm::LibFunc::memcmp, and llvm::StringRef::size().
Referenced by llvm::A64StringToCondCode(), llvm::A64StringToVectorLayout(), llvm::StringSwitch< T, R >::Cases(), llvm::DWARFContextInMemory::DWARFContextInMemory(), llvm::Triple::getArchNameForAssembler(), llvm::Triple::getArchTypeForLLVMName(), llvm::objcarc::GetFunctionClass(), parseArch(), parseVendor(), and RecognizePersonality().
|
inline |
Definition at line 85 of file StringSwitch.h.
References llvm::StringSwitch< T, R >::Case().
Referenced by llvm::createARMAsmBackend(), llvm::Triple::getArchNameForAssembler(), getIntelMemOperandSize(), and parseArch().
|
inline |
Definition at line 91 of file StringSwitch.h.
References llvm::StringSwitch< T, R >::Case().
|
inline |
Definition at line 97 of file StringSwitch.h.
References llvm::StringSwitch< T, R >::Case().
|
inline |
Definition at line 104 of file StringSwitch.h.
References llvm::StringSwitch< T, R >::Case().
|
inline |
Definition at line 111 of file StringSwitch.h.
Referenced by llvm::A64StringToCondCode(), llvm::A64StringToVectorLayout(), llvm::createARMAsmBackend(), llvm::createX86_64AsmBackend(), llvm::DWARFContextInMemory::DWARFContextInMemory(), llvm::Triple::getArchNameForAssembler(), llvm::Triple::getArchTypeForLLVMName(), llvm::objcarc::GetFunctionClass(), getIntelMemOperandSize(), parseArch(), parseEnvironment(), parseOS(), parseVendor(), and RecognizePersonality().
|
inline |
Definition at line 65 of file StringSwitch.h.
References llvm::StringRef::data(), llvm::LibFunc::memcmp, N, and llvm::StringRef::size().
|
inline |
Definition at line 118 of file StringSwitch.h.
|
inline |
Definition at line 75 of file StringSwitch.h.
References llvm::StringRef::data(), llvm::LibFunc::memcmp, and llvm::StringRef::size().
Referenced by parseArch(), parseEnvironment(), and parseOS().