4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
9 * Full author contact details are available in file CREDITS.
22 * This struct represents a particular LyX "module", which is a like a layout
23 * file, except that it does not stand alone. In that sense, it is more like
24 * a LaTeX package, where a layout file corresponds to a LaTeX class. Or, in
25 * LyX's own terms, a module is more like an included file that can be used
26 * with various document classes. The difference is that using a module only
27 * means selecting it in the Document>Settings dialog, whereas including a
28 * layout file means layout file editing.
30 * In general, a given module can be used with any document class. That said,
31 * one module may `require' another, or it may `exclude' some other module.
32 * The requires and excludes are given in comments within the module file,
33 * which must begin roughly so:
34 * #\DeclareLyXModule{Theorems (By Section)}
36 * #Numbers theorems and the like by section.
38 * #Requires: theorems-std | theorems-ams
39 * #Excludes: theorems-chap
40 * The description is used in the gui to give information to the user. The
41 * Requires and Excludes lines are read by the configuration script and
42 * written to a file lyxmodules.lst in the user configuration directory.
44 * Modules can also be "provided" or "excluded" by document classes, using
45 * the ProvidesModule and ExcludesModule tags.
51 LyXModule(std::string const & n, std::string const & i,
52 std::string const & d, std::vector<std::string> const & p,
53 std::vector<std::string> const & r,
54 std::vector<std::string> const & e);
55 /// whether the required packages are available
58 std::string const & getName() const { return name; }
60 std::string const & getID() const { return id; }
62 std::string const & getFilename() const { return filename; }
64 std::string const & getDescription() const { return description; }
66 std::vector<std::string> const & getPackageList() const
67 { return packageList; }
69 std::vector<std::string> const & getRequiredModules() const
70 { return requiredModules; }
71 /// Modules this one excludes: the list should be treated disjunctively
72 std::vector<std::string> const & getExcludedModules() const
73 { return excludedModules; }
74 /// \return true if the module is compatible with this one, i.e.,
75 /// it does not exclude us and we do not exclude it.
76 /// this will also return true if modName is unknown and we do not
77 /// exclude it, since in that case we cannot check its exclusions.
78 bool isCompatible(std::string const & modName) const;
80 static bool areCompatible(std::string const & mod1, std::string const & mod2);
82 /// what appears in the ui
84 /// the module's unique identifier
85 /// at present, this is the filename, without the extension
89 /// a short description for use in the ui
90 std::string description;
91 /// the LaTeX packages on which this depends, if any
92 std::vector<std::string> packageList;
93 /// Modules this one requires: at least one
94 std::vector<std::string> requiredModules;
95 /// Modules this one excludes: none of these
96 std::vector<std::string> excludedModules;
103 typedef std::vector<LyXModule> LyXModuleList;
106 * The ModuleList represents the various LyXModule's that are available at
113 /// reads the modules from a file generated by configure.py
116 LyXModuleList::const_iterator begin() const;
118 LyXModuleList::iterator begin();
120 LyXModuleList::const_iterator end() const;
122 LyXModuleList::iterator end();
124 bool empty() const { return modlist_.empty(); }
125 /// Returns a pointer to the LyXModule with filename str.
126 /// Returns a null pointer if no such module is found.
127 LyXModule * operator[](std::string const & str);
130 ModuleList(ModuleList const &);
132 void operator=(ModuleList const &);
133 /// add a module to the list
134 void addLayoutModule(std::string const &, std::string const &,
135 std::string const &, std::vector<std::string> const &,
136 std::vector<std::string> const &, std::vector<std::string> const &);
138 std::vector<LyXModule> modlist_;
141 extern ModuleList moduleList;