diff options
Diffstat (limited to 'source/core')
| -rw-r--r-- | source/core/slang-rtti-info.h | 3 | ||||
| -rw-r--r-- | source/core/slang-string.cpp | 17 | ||||
| -rw-r--r-- | source/core/slang-string.h | 3 |
3 files changed, 22 insertions, 1 deletions
diff --git a/source/core/slang-rtti-info.h b/source/core/slang-rtti-info.h index 36651c32b..e9296c3ff 100644 --- a/source/core/slang-rtti-info.h +++ b/source/core/slang-rtti-info.h @@ -170,6 +170,7 @@ struct StructRttiInfo : public NamedRttiInfo Index m_fieldCount; ///< Amount of fields const Field* m_fields; ///< Fields + bool m_ignoreUnknownFieldsInJson = false; }; struct EnumRttiInfo : public NamedRttiInfo @@ -330,6 +331,8 @@ struct StructRttiBuilder m_fields.add(field); } + void ignoreUnknownFields() { m_rttiInfo.m_ignoreUnknownFieldsInJson = true; } + StructRttiInfo make(); void _init(const char* name, const StructRttiInfo* super, const Byte* base); diff --git a/source/core/slang-string.cpp b/source/core/slang-string.cpp index 5f2ba13ba..9b3575ad8 100644 --- a/source/core/slang-string.cpp +++ b/source/core/slang-string.cpp @@ -155,12 +155,27 @@ namespace Slang end() - otherSize, end()) == other; } + bool UnownedStringSlice::endsWithCaseInsensitive(UnownedStringSlice const& other) const + { + UInt thisSize = getLength(); + UInt otherSize = other.getLength(); + + if (otherSize > thisSize) + return false; + + return UnownedStringSlice(end() - otherSize, end()).caseInsensitiveEquals(other); + } + bool UnownedStringSlice::endsWith(char const* str) const { return endsWith(UnownedTerminatedStringSlice(str)); } - + bool UnownedStringSlice::endsWithCaseInsensitive(char const* str) const + { + return endsWithCaseInsensitive(UnownedTerminatedStringSlice(str)); + } + UnownedStringSlice UnownedStringSlice::trim() const { const char* start = m_begin; diff --git a/source/core/slang-string.h b/source/core/slang-string.h index e8ee76397..59d441b76 100644 --- a/source/core/slang-string.h +++ b/source/core/slang-string.h @@ -157,6 +157,9 @@ namespace Slang bool startsWith(UnownedStringSlice const& other) const; bool startsWith(char const* str) const; + bool endsWithCaseInsensitive(UnownedStringSlice const& other) const; + bool endsWithCaseInsensitive(char const* str) const; + bool endsWith(UnownedStringSlice const& other) const; bool endsWith(char const* str) const; |
