]> git.lyx.org Git - lyx.git/blobdiff - src/ModuleList.h
reorder.
[lyx.git] / src / ModuleList.h
index 804cce1dea52a6c2563767316f1906e3f77f24b9..adee14525419425741a7d1ca18cf04e430bc1c3d 100644 (file)
@@ -21,10 +21,30 @@ 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.
+ *  a LaTeX package, where a layout file corresponds to a LaTeX class. Or, in 
+ *  LyX's own terms, a module is more like an included file that can be used
+ *  with various document classes. The difference is that using a module only
+ *  means selecting it in the Document>Settings dialog, whereas including a 
+ *  layout file means layout file editing.
+ *
+ *  In general, a given module can be used with any document class. That said,
+ *  one module may `require' another, or it may `exclude' some other module.
+ *  The requires and excludes are given in comments within the module file,
+ *  which must begin roughly so:
+ *   #\DeclareLyXModule{Theorems (By Section)}
+ *   #DescriptionBegin
+ *   #Numbers theorems and the like by section.
+ *   #DescriptionEnd
+ *   #Requires: theorems-std | theorems-ams
+ *   #Excludes: theorems-chap
+ *  The description is used in the gui to give information to the user. The
+ *  Requires and Excludes lines are read by the configuration script and
+ *  written to a file lyxmodules.lst in the user configuration directory.
+ *
+ *  Modules can also be "provided" or "excluded" by document classes, using
+ *  the ProvidesModule and ExcludesModule tags.
  */
 
-//FIXME Give us some access functions here.
 class LyXModule {
 public:
        ///
@@ -51,7 +71,13 @@ public:
        /// Modules this one excludes: the list should be treated disjunctively
        std::vector<std::string> const & getExcludedModules() const 
                { return excludedModules; }
-       
+       /// \return true if the module is compatible with this one, i.e.,
+       /// it does not exclude us and we do not exclude it.
+       /// this will also return true if modName is unknown and we do not
+       /// exclude it, since in that case we cannot check its exclusions.
+       bool isCompatible(std::string const & modName) const;
+       ///
+       static bool areCompatible(std::string const & mod1, std::string const & mod2);
 private:
        /// what appears in the ui
        std::string name;
@@ -85,7 +111,7 @@ public:
        ///
        ModuleList() {}
        /// reads the modules from a file generated by configure.py
-       bool load();
+       bool read();
        ///
        LyXModuleList::const_iterator begin() const;
        ///
@@ -96,13 +122,10 @@ public:
        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:
+private:
        /// noncopyable
        ModuleList(ModuleList const &);
        ///