diff --git a/src/LayoutFile.h b/src/LayoutFile.h index eda75c20b4..847b469435 100644 --- a/src/LayoutFile.h +++ b/src/LayoutFile.h @@ -13,6 +13,7 @@ #ifndef BASECLASSLIST_H #define BASECLASSLIST_H +#include "LayoutModuleList.h" #include "TextClass.h" #include "support/strfwd.h" @@ -65,13 +66,13 @@ public: /// check whether the TeX class is available bool isTeXClassAvailable() const { return texClassAvail_; } /// - std::list const & defaultModules() const + LayoutModuleList const & defaultModules() const { return default_modules_; } /// - std::list const & providedModules() const + LayoutModuleList const & providedModules() const { return provided_modules_; } /// - std::list const & excludedModules() const + LayoutModuleList const & excludedModules() const { return excluded_modules_; } private: /// Construct a layout with default values. Actual values loaded later. diff --git a/src/LayoutModuleList.h b/src/LayoutModuleList.h index 80922ff1e4..9229f80f6b 100644 --- a/src/LayoutModuleList.h +++ b/src/LayoutModuleList.h @@ -16,7 +16,39 @@ #include namespace lyx { -/// -typedef std::list LayoutModuleList; + +class LayoutModuleList { +public: + /// + typedef std::list::const_iterator const_iterator; + /// + typedef std::list::iterator iterator; + /// + iterator begin() { return lml_.begin(); } + /// + iterator end() { return lml_.end(); } + /// + const_iterator begin() const { return lml_.begin(); } + /// + const_iterator end() const { return lml_.end(); } + /// + void clear() { lml_.clear(); } + /// + bool empty() const { return lml_.empty(); } + /// + iterator erase(iterator pos) { return lml_.erase(pos); } + /// + iterator insert(iterator pos, std::string const & str) + { return lml_.insert(pos, str); } + /// + void push_back(std::string const & str) { lml_.push_back(str); } + /// + size_t size() const { return lml_.size(); } + /// This is needed in GuiDocument. It seems better than an + /// implicit conversion. + std::list const & list() const { return lml_; } +private: + std::list lml_; +}; } #endif diff --git a/src/frontends/qt4/GuiDocument.cpp b/src/frontends/qt4/GuiDocument.cpp index 1363065e3d..0e34658cfb 100644 --- a/src/frontends/qt4/GuiDocument.cpp +++ b/src/frontends/qt4/GuiDocument.cpp @@ -34,6 +34,7 @@ #include "Language.h" #include "LaTeXFeatures.h" #include "Layout.h" +#include "LayoutModuleList.h" #include "LyXRC.h" #include "ModuleList.h" #include "OutputParams.h" @@ -252,11 +253,11 @@ public: upPB, downPB, availableModel, selectedModel), container_(container) {} /// - void updateProvidedModules(std::list const & pm) - { provided_modules_ = pm; } + void updateProvidedModules(LayoutModuleList const & pm) + { provided_modules_ = pm.list(); } /// - void updateExcludedModules(std::list const & em) - { excluded_modules_ = em; } + void updateExcludedModules(LayoutModuleList const & em) + { excluded_modules_ = em.list(); } private: /// virtual void updateAddPB(); @@ -1409,7 +1410,7 @@ void GuiDocument::modulesToParams(BufferParams & bp) // update the list of removed modules bp.clearRemovedModules(); - list const & reqmods = bp.baseClass()->defaultModules(); + LayoutModuleList const & reqmods = bp.baseClass()->defaultModules(); list::const_iterator rit = reqmods.begin(); list::const_iterator ren = reqmods.end(); @@ -1457,7 +1458,7 @@ void GuiDocument::updateModuleInfo() string const modName = id_model.getIDString(idx.row()); docstring desc = getModuleDescription(modName); - list const & provmods = bp_.baseClass()->providedModules(); + LayoutModuleList const & provmods = bp_.baseClass()->providedModules(); if (std::find(provmods.begin(), provmods.end(), modName) != provmods.end()) { if (!desc.empty()) desc += "\n"; @@ -2282,10 +2283,10 @@ list const & GuiDocument::getModuleInfo() list const - GuiDocument::makeModuleInfo(list const & mods) + GuiDocument::makeModuleInfo(LayoutModuleList const & mods) { - list::const_iterator it = mods.begin(); - list::const_iterator end = mods.end(); + LayoutModuleList::const_iterator it = mods.begin(); + LayoutModuleList::const_iterator end = mods.end(); list mInfo; for (; it != end; ++it) { modInfoStruct m; diff --git a/src/frontends/qt4/GuiDocument.h b/src/frontends/qt4/GuiDocument.h index c5c1c55bf1..e9964a9971 100644 --- a/src/frontends/qt4/GuiDocument.h +++ b/src/frontends/qt4/GuiDocument.h @@ -41,6 +41,7 @@ namespace lyx { class BufferParams; class FloatPlacement; +class LayoutModuleList; class TextClass; namespace frontend { @@ -188,7 +189,7 @@ private: std::list const getProvidedModules(); /// std::list const - makeModuleInfo(std::list const & mods); + makeModuleInfo(LayoutModuleList const & mods); /// void setLanguage() const; /// diff --git a/src/insets/InsetInclude.cpp b/src/insets/InsetInclude.cpp index 43d2ad8528..4521fa43b0 100644 --- a/src/insets/InsetInclude.cpp +++ b/src/insets/InsetInclude.cpp @@ -27,6 +27,7 @@ #include "FuncStatus.h" #include "LaTeXFeatures.h" #include "LayoutFile.h" +#include "LayoutModuleList.h" #include "LyX.h" #include "LyXFunc.h" #include "LyXRC.h" @@ -499,13 +500,13 @@ int InsetInclude::latex(odocstream & os, OutputParams const & runparams) const // Make sure modules used in child are all included in master //FIXME It might be worth loading the children's modules into the master //over in BufferParams rather than doing this check. - list const masterModules = masterBuffer->params().getModules(); - list const childModules = tmp->params().getModules(); - list::const_iterator it = childModules.begin(); - list::const_iterator end = childModules.end(); + LayoutModuleList const masterModules = masterBuffer->params().getModules(); + LayoutModuleList const childModules = tmp->params().getModules(); + LayoutModuleList::const_iterator it = childModules.begin(); + LayoutModuleList::const_iterator end = childModules.end(); for (; it != end; ++it) { string const module = *it; - list::const_iterator found = + LayoutModuleList::const_iterator found = find(masterModules.begin(), masterModules.end(), module); if (found == masterModules.end()) { docstring text = bformat(_("Included file `%1$s'\n"