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.
48 LyXModule(std::string const & n, std::string const & i,
49 std::string const & d, std::vector<std::string> const & p,
50 std::vector<std::string> const & r,
51 std::vector<std::string> const & e);
52 /// whether the required packages are available
55 std::string const & getName() const { return name; }
57 std::string const & getID() const { return id; }
59 std::string const & getFilename() const { return filename; }
61 std::string const & getDescription() const { return description; }
63 std::vector<std::string> const & getPackageList() const
64 { return packageList; }
66 std::vector<std::string> const & getRequiredModules() const
67 { return requiredModules; }
68 /// Modules this one excludes: the list should be treated disjunctively
69 std::vector<std::string> const & getExcludedModules() const
70 { return excludedModules; }
71 /// \return true if the module is compatible with this one, i.e.,
72 /// it does not exclude us and we do not exclude it.
73 /// this will also return true if modName is unknown and we do not
74 /// exclude it, since in that case we cannot check its exclusions.
75 bool isCompatible(std::string const & modName) const;
77 static bool areCompatible(std::string const & mod1, std::string const & mod2);
79 /// what appears in the ui
81 /// the module's unique identifier
82 /// at present, this is the filename, without the extension
86 /// a short description for use in the ui
87 std::string description;
88 /// the LaTeX packages on which this depends, if any
89 std::vector<std::string> packageList;
90 /// Modules this one requires: at least one
91 std::vector<std::string> requiredModules;
92 /// Modules this one excludes: none of these
93 std::vector<std::string> excludedModules;
100 typedef std::vector<LyXModule> LyXModuleList;
103 * The ModuleList represents the various LyXModule's that are available at
110 /// reads the modules from a file generated by configure.py
113 LyXModuleList::const_iterator begin() const;
115 LyXModuleList::iterator begin();
117 LyXModuleList::const_iterator end() const;
119 LyXModuleList::iterator end();
121 bool empty() const { return modlist_.empty(); }
122 /// Returns a pointer to the LyXModule with filename str.
123 /// Returns a null pointer if no such module is found.
124 LyXModule * operator[](std::string const & str);
127 ModuleList(ModuleList const &);
129 void operator=(ModuleList const &);
130 /// add a module to the list
131 void addLayoutModule(std::string const &, std::string const &,
132 std::string const &, std::vector<std::string> const &,
133 std::vector<std::string> const &, std::vector<std::string> const &);
135 std::vector<LyXModule> modlist_;
138 extern ModuleList moduleList;