X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FModuleList.cpp;h=14e2917159bddeeea7fb184ad714221ed823c6a5;hb=700af7e7011f102d92222744791638ff2db18f94;hp=bd035f49664600463b1c8601a8be54c6b61dfbef;hpb=7c28905b177b8366531915903ac903a0fff716de;p=lyx.git diff --git a/src/ModuleList.cpp b/src/ModuleList.cpp index bd035f4966..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() { @@ -49,12 +51,14 @@ bool LyXModule::isAvailable() { if (checked) return available; checked = true; + //check whether all of the required packages are available vector::const_iterator it = packageList.begin(); vector::const_iterator end = packageList.end(); for (; it != end; ++it) { - if (!LaTeXFeatures::isAvailable(*it)) + if (!LaTeXFeatures::isAvailable(*it)) { available = false; return available; + } } available = true; return available; @@ -72,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"); @@ -202,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) @@ -213,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