diff options
Diffstat (limited to 'source/core')
| -rw-r--r-- | source/core/slang-char-util.h | 2 | ||||
| -rw-r--r-- | source/core/slang-command-line.cpp | 8 | ||||
| -rw-r--r-- | source/core/slang-command-line.h | 2 |
3 files changed, 12 insertions, 0 deletions
diff --git a/source/core/slang-char-util.h b/source/core/slang-char-util.h index f831f6d55..40abee602 100644 --- a/source/core/slang-char-util.h +++ b/source/core/slang-char-util.h @@ -30,6 +30,8 @@ struct CharUtil /// True if it's alpha SLANG_FORCE_INLINE static bool isAlpha(char c) { return (getFlags(c) & (Flag::Upper | Flag::Lower)) != 0; } + /// True if it's alpha or a digit + SLANG_FORCE_INLINE static bool isAlphaOrDigit(char c) { return (getFlags(c) & (Flag::Upper | Flag::Lower | Flag::Digit)) != 0; } /// True if the character is a valid hex character SLANG_FORCE_INLINE static bool isHexDigit(char c) { return (getFlags(c) & Flag::HexDigit) != 0; } diff --git a/source/core/slang-command-line.cpp b/source/core/slang-command-line.cpp index f8b5ff10f..59e6a6265 100644 --- a/source/core/slang-command-line.cpp +++ b/source/core/slang-command-line.cpp @@ -116,6 +116,14 @@ void CommandLine::appendArgs(StringBuilder& out) const } } +void CommandLine::addArgIfNotFound(const String& in) +{ + if (m_args.indexOf(in) < 0) + { + addArg(in); + } +} + String CommandLine::toString() const { StringBuilder buf; diff --git a/source/core/slang-command-line.h b/source/core/slang-command-line.h index f2007865f..163daf710 100644 --- a/source/core/slang-command-line.h +++ b/source/core/slang-command-line.h @@ -62,6 +62,8 @@ struct CommandLine void addArg(const String& in) { m_args.add(in); } void addArgs(const String* args, Int argsCount) { for (Int i = 0; i < argsCount; ++i) addArg(args[i]); } + void addArgIfNotFound(const String& in); + /// Find the index of an arg which is exact match for slice SLANG_INLINE Index findArgIndex(const UnownedStringSlice& slice) const { return m_args.indexOf(slice); } |
