ASCII character bitset useful for fast and readable parsing 更多...
#include <AsciiSet.h>
Public 成员函数 | |
| template<typename CharType > | |
| constexpr FORCEINLINE bool | Contains (CharType Char) const |
| Returns true if a character is part of the set | |
| constexpr FORCEINLINE FAsciiSet | operator+ (char Char) const |
| Create new set with specified character in it | |
| constexpr FORCEINLINE FAsciiSet | operator~ () const |
| Create new set containing inverse set of characters - likely including null-terminator | |
| template<typename CharType > | |
| constexpr FORCEINLINE uint64 | Test (CharType Char) const |
| Returns non-zero if a character is part of the set. 更多... | |
静态 Public 成员函数 | |
| template<class CharType > | |
| static constexpr const CharType * | FindFirstOrEnd (const CharType *Str, FAsciiSet Set) |
| Find first character of string inside set or end pointer. 更多... | |
| template<class CharType > | |
| static constexpr const CharType * | FindLastOrEnd (const CharType *Str, FAsciiSet Set) |
| Find last character of string inside set or end pointer. 更多... | |
| template<typename CharType > | |
| static constexpr bool | HasAny (const CharType *Str, FAsciiSet Set) |
| Test if string contains any character in set | |
| template<typename CharType > | |
| static constexpr bool | HasNone (const CharType *Str, FAsciiSet Set) |
| Test if string contains no character in set | |
| template<typename CharType > | |
| static constexpr bool | HasOnly (const CharType *Str, FAsciiSet Set) |
| Test if string contains any character outside of set | |
| template<typename CharType > | |
| static constexpr const CharType * | Skip (const CharType *Str, FAsciiSet Set) |
| Find first character of string outside of set. 更多... | |
ASCII character bitset useful for fast and readable parsing
Entirely constexpr. Works with both wide and narrow strings.
Example use cases:
constexpr FAsciiSet WhitespaceCharacters(" \v\f\t\r\n"); bool bIsWhitespace = WhitespaceCharacters.Test(MyChar); const char* HelloWorld = FAsciiSet::Skip(" \t\tHello world!", WhitespaceCharacters);
constexpr FAsciiSet XmlEscapeChars("&<>\"'"); check(FAsciiSet::HasNone(EscapedXmlString, XmlEscapeChars));
constexpr FAsciiSet Delimiters(".:;"); const TCHAR* DelimiterOrEnd = FAsciiSet::FindFirstOrEnd(PrefixedName, Delimiters); FString Prefix(PrefixedName, DelimiterOrEnd - PrefixedName);
constexpr FAsciiSet Slashes("/\\"); const TCHAR* SlashOrEnd = FAsciiSet::FindLastOrEnd(PathName, Slashes); const TCHAR* FileName = *SlashOrEnd ? SlashOrEnd + 1 : PathName;
|
inlinestaticconstexpr |
Find first character of string inside set or end pointer.
Never returns null.
|
inlinestaticconstexpr |
Find last character of string inside set or end pointer.
Never returns null.
|
inlinestaticconstexpr |
Find first character of string outside of set.
Never returns null.
|
inlineconstexpr |
Returns non-zero if a character is part of the set.
Prefer Contains() to avoid VS2019 conversion warnings.