From c8136baf0e923ea16cb5e75d75539ca61129925a Mon Sep 17 00:00:00 2001 From: Neil Date: Thu, 11 Jun 2020 10:07:30 +1000 Subject: Backport: Use const and noexcept for CatalogueModules. While CatalogueModules is in lexlib, it is newer with few users so does not have to remain as fixed as other files in lexlib. Backport of changeset 8299:8473e407264e. --- lexlib/CatalogueModules.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'lexlib') diff --git a/lexlib/CatalogueModules.h b/lexlib/CatalogueModules.h index 00ac88d62..b290a74ea 100644 --- a/lexlib/CatalogueModules.h +++ b/lexlib/CatalogueModules.h @@ -15,7 +15,7 @@ namespace Scintilla { class CatalogueModules { std::vector lexerCatalogue; public: - const LexerModule *Find(int language) { + const LexerModule *Find(int language) const { for (const LexerModule *lm : lexerCatalogue) { if (lm->GetLanguage() == language) { return lm; @@ -24,7 +24,7 @@ public: return nullptr; } - const LexerModule *Find(const char *languageName) { + const LexerModule *Find(const char *languageName) const noexcept { if (languageName) { for (const LexerModule *lm : lexerCatalogue) { if (lm->languageName && (0 == strcmp(lm->languageName, languageName))) { @@ -39,11 +39,11 @@ public: lexerCatalogue.push_back(plm); } - unsigned int Count() { + unsigned int Count() const noexcept { return static_cast(lexerCatalogue.size()); } - const char *Name(unsigned int index) { + const char *Name(unsigned int index) const noexcept { if (index < static_cast(lexerCatalogue.size())) { return lexerCatalogue[index]->languageName; } else { @@ -51,12 +51,12 @@ public: } } - LexerFactoryFunction Factory(unsigned int index) { + LexerFactoryFunction Factory(unsigned int index) const noexcept { // Works for object lexers but not for function lexers return lexerCatalogue[index]->fnFactory; } - ILexer *Create(unsigned int index) { + ILexer *Create(unsigned int index) const { const LexerModule *plm = lexerCatalogue[index]; if (!plm) { return nullptr; -- cgit v1.2.3