From b34e1a6efefd7b39f14daa867510b2e2d453a0bb Mon Sep 17 00:00:00 2001 From: Neil Date: Thu, 11 Jun 2020 10:07:30 +1000 Subject: 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. --- lexlib/CatalogueModules.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lexlib/CatalogueModules.h b/lexlib/CatalogueModules.h index 197a66460..267a7b82b 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; } - ILexer5 *Create(unsigned int index) { + ILexer5 *Create(unsigned int index) const { const LexerModule *plm = lexerCatalogue[index]; if (!plm) { return nullptr; -- cgit v1.2.3