From c16abd4fe1bda5ebcd50dbb22f30c6be43bb885f Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Thu, 7 May 2020 15:00:33 -0400 Subject: Enhanced C++ extractor (#1340) * Extractor builds without any reference to syntax (as it will be helping to produce this!). * Change macros to include the super class. * Added indexOf(const UnownedSubString& in) to UnownedSubString. Refactored extractor * Output a macro for each type with the extracted info - can be used during injection in class * Simplify the header file - as can get super type and last from macro now * Store the 'origin' of a definition * Some small tidy ups to the extractor. * Improve comments on the extractor options. * Made CPPExtractor own SourceOrigins * Small fixes around SourceOrigin. * Small tidy up around macroOrign --- source/core/slang-string.h | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'source/core/slang-string.h') diff --git a/source/core/slang-string.h b/source/core/slang-string.h index 10bc76048..5eb113dc1 100644 --- a/source/core/slang-string.h +++ b/source/core/slang-string.h @@ -104,18 +104,11 @@ namespace Slang return Index(m_end - m_begin); } - Index indexOf(char c) const - { - const Index size = int(m_end - m_begin); - for (Index i = 0; i < size; ++i) - { - if (m_begin[i] == c) - { - return i; - } - } - return -1; - } + /// Finds first index of char 'c'. If not found returns -1. + Index indexOf(char c) const; + /// Find first index of slice. If not found returns -1 + Index indexOf(const UnownedStringSlice& slice) const; + Index lastIndexOf(char c) const { const Index size = Index(m_end - m_begin); -- cgit v1.2.3