X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FModuleList.h;h=804cce1dea52a6c2563767316f1906e3f77f24b9;hb=ac3f391b46d25784f3129e24658b73c4bc15febf;hp=29931fd8ed03a9087d24f63bc90d59d99263de08;hpb=8a947f63da25582224d20b29fadba6128f271555;p=lyx.git diff --git a/src/ModuleList.h b/src/ModuleList.h index 29931fd8ed..804cce1dea 100644 --- a/src/ModuleList.h +++ b/src/ModuleList.h @@ -12,63 +12,109 @@ #ifndef MODULELIST_H #define MODULELIST_H -#include -#include "support/FileName.h" - -#include - #include +#include +#include namespace lyx { - /** - * This struct represents a particular LyX "module", which is a like a layout - * file, except that it does not stand alone. In that sense, it is more like - * a LaTeX package, where a layout file corresponds to a LaTeX class. - */ - struct LyXModule { - /// what appears in the ui - std::string name; - /// the filename, without any path - std::string filename; - /// a short description for use in the ui - std::string description; - /// the LaTeX packages on which this depends, if any (not implemented) - //std::vector packageList; - /// whether those packages are available (not implemented yet) - //bool available; - }; - - typedef std::vector LyXModuleList; +/** + * This struct represents a particular LyX "module", which is a like a layout + * file, except that it does not stand alone. In that sense, it is more like + * a LaTeX package, where a layout file corresponds to a LaTeX class. + */ + +//FIXME Give us some access functions here. +class LyXModule { +public: + /// + LyXModule(std::string const & n, std::string const & i, + std::string const & d, std::vector const & p, + std::vector const & r, + std::vector const & e); + /// whether the required packages are available + bool isAvailable(); + /// + std::string const & getName() const { return name; } + /// + std::string const & getID() const { return id; } + /// + std::string const & getFilename() const { return filename; } + /// + std::string const & getDescription() const { return description; } + /// + std::vector const & getPackageList() const + { return packageList; } + /// + std::vector const & getRequiredModules() const + { return requiredModules; } + /// Modules this one excludes: the list should be treated disjunctively + std::vector const & getExcludedModules() const + { return excludedModules; } - /** - * The ModuleList represents the various LyXModule's that are available at - * present. - */ - class ModuleList : boost::noncopyable { - public: - /// reads the modules from a file generated by configure.py - bool load(); - /// add a module to the list - void addLayoutModule(std::string name, std::string filename, - std::string description); - /// - LyXModuleList::const_iterator begin() const; - /// - LyXModuleList::iterator begin(); - /// - LyXModuleList::const_iterator end() const; - /// - LyXModuleList::iterator end(); - /// - bool empty() { return modlist_.empty(); }; - /// Returns a pointer to the LyXModule with name str. - /// Returns a null pointer if no such module is found. - LyXModule * operator[](std::string str); - private: - std::vector modlist_; - }; +private: + /// what appears in the ui + std::string name; + /// the module's unique identifier + /// at present, this is the filename, without the extension + std::string id; + /// the filename + std::string filename; + /// a short description for use in the ui + std::string description; + /// the LaTeX packages on which this depends, if any + std::vector packageList; + /// Modules this one requires: at least one + std::vector requiredModules; + /// Modules this one excludes: none of these + std::vector excludedModules; + /// + bool checked; + /// + bool available; +}; + +typedef std::vector LyXModuleList; + +/** + * The ModuleList represents the various LyXModule's that are available at + * present. + */ +class ModuleList { +public: + /// + ModuleList() {} + /// reads the modules from a file generated by configure.py + bool load(); + /// + LyXModuleList::const_iterator begin() const; + /// + LyXModuleList::iterator begin(); + /// + LyXModuleList::const_iterator end() const; + /// + LyXModuleList::iterator end(); + /// + bool empty() const { return modlist_.empty(); } + /// Returns a pointer to the LyXModule with name str. + /// Returns a null pointer if no such module is found. + LyXModule * getModuleByName(std::string const & str); + /// Returns a pointer to the LyXModule with filename str. + /// Returns a null pointer if no such module is found. + LyXModule * operator[](std::string const & str); + private: + /// noncopyable + ModuleList(ModuleList const &); + /// + void operator=(ModuleList const &); + /// add a module to the list + void addLayoutModule(std::string const &, std::string const &, + std::string const &, std::vector const &, + std::vector const &, std::vector const &); + /// + std::vector modlist_; +}; - extern ModuleList moduleList; +extern ModuleList moduleList; } #endif