X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FModuleList.cpp;h=14e2917159bddeeea7fb184ad714221ed823c6a5;hb=027563eec2d2a1b81391b221f9ca40d823713235;hp=0b88a8e8f24d1fcb881a1682c0796f335b814a34;hpb=5faad9ca68779c2a9f03a6ad0986ec1d7be6b5ec;p=lyx.git diff --git a/src/ModuleList.cpp b/src/ModuleList.cpp index 0b88a8e8f2..14e2917159 100644 --- a/src/ModuleList.cpp +++ b/src/ModuleList.cpp @@ -13,10 +13,10 @@ #include "ModuleList.h" -#include "support/debug.h" #include "LaTeXFeatures.h" #include "Lexer.h" +#include "support/debug.h" #include "support/FileName.h" #include "support/filetools.h" #include "support/lstrings.h" @@ -34,13 +34,15 @@ namespace lyx { ModuleList moduleList; -LyXModule::LyXModule(string const & n, string const & f, +LyXModule::LyXModule(string const & n, string const & i, string const & d, vector const & p, vector const & r, vector const & e): - name(n), filename(f), description(d), + name(n), id(i), description(d), packageList(p), requiredModules(r), excludedModules(e), checked(false) -{} +{ + filename = id + ".module"; +} bool LyXModule::isAvailable() { @@ -74,7 +76,7 @@ public: }; -//Much of this is borrowed from TextClassList::read() +//Much of this is borrowed from LayoutFileList::read() bool ModuleList::load() { FileName const real_file = libFileSearch("", "lyxmodules.lst"); @@ -204,7 +206,7 @@ LyXModuleList::iterator ModuleList::end() } -LyXModule * ModuleList::operator[](string const & str) +LyXModule * ModuleList::getModuleByName(string const & str) { LyXModuleList::iterator it = modlist_.begin(); for (; it != modlist_.end(); ++it) @@ -215,4 +217,15 @@ LyXModule * ModuleList::operator[](string const & str) return 0; } +LyXModule * ModuleList::operator[](string const & str) +{ + LyXModuleList::iterator it = modlist_.begin(); + for (; it != modlist_.end(); ++it) + if (it->getID() == str) { + LyXModule & mod = *it; + return &mod; + } + return 0; +} + } // namespace lyx