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 class 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
41 * The description is used in the gui to give information to the user. The
42 * Requires, Excludes, and Categofy lines are read by the configuration script
43 * and written to a file lyxmodules.lst in the user configuration directory.
44 * That file is then read on startup to populate the ModuleList, below.
46 * Modules can also be "provided" or "excluded" by document classes, using
47 * the ProvidesModule and ExcludesModule tags.
53 LyXModule(std::string const & n, std::string const & i,
54 std::string const & d, std::vector<std::string> const & p,
55 std::vector<std::string> const & r,
56 std::vector<std::string> const & e,
57 std::string const & c);
58 /// whether the required packages are available
61 std::string const & getName() const { return name; }
63 std::string const & getID() const { return id; }
65 std::string const & getFilename() const { return filename; }
67 std::string const & getDescription() const { return description; }
69 std::vector<std::string> const & getPackageList() const
70 { return packageList; }
72 std::vector<std::string> const & getRequiredModules() const
73 { return requiredModules; }
74 /// Modules this one excludes: the list should be treated disjunctively
75 std::vector<std::string> const & getExcludedModules() const
76 { return excludedModules; }
78 std::string category() const { return category_; }
79 /// \return true if the module is compatible with this one, i.e.,
80 /// it does not exclude us and we do not exclude it.
81 /// this will also return true if modName is unknown and we do not
82 /// exclude it, since in that case we cannot check its exclusions.
83 bool isCompatible(std::string const & modName) const;
85 static bool areCompatible(std::string const & mod1, std::string const & mod2);
87 /// what appears in the ui
89 /// the module's unique identifier
90 /// at present, this is the filename, without the extension
94 /// a short description for use in the ui
95 std::string description;
96 /// the LaTeX packages on which this depends, if any
97 std::vector<std::string> packageList;
98 /// Modules this one requires: at least one
99 std::vector<std::string> requiredModules;
100 /// Modules this one excludes: none of these
101 std::vector<std::string> excludedModules;
103 std::string category_;
110 typedef std::vector<LyXModule> LyXModuleList;
113 * The ModuleList represents the various LyXModule's that are available at
120 /// reads the modules from a file generated by configure.py
123 LyXModuleList::const_iterator begin() const;
125 LyXModuleList::iterator begin();
127 LyXModuleList::const_iterator end() const;
129 LyXModuleList::iterator end();
131 bool empty() const { return modlist_.empty(); }
132 /// Returns a pointer to the LyXModule with filename str.
133 /// Returns a null pointer if no such module is found.
134 LyXModule * operator[](std::string const & str);
137 ModuleList(ModuleList const &);
139 void operator=(ModuleList const &);
140 /// add a module to the list
141 void addLayoutModule(std::string const &, std::string const &,
142 std::string const &, std::vector<std::string> const &,
143 std::vector<std::string> const &, std::vector<std::string> const &,
144 std::string const &);
146 std::vector<LyXModule> modlist_;
149 extern ModuleList moduleList;