]> git.lyx.org Git - lyx.git/blob - src/ModuleList.h
make frontend::Application a bit slimmer
[lyx.git] / src / ModuleList.h
1 // -*- C++ -*-
2 /**
3  * \file ModuleList.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Richard Heck
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef MODULELIST_H
13 #define MODULELIST_H
14
15 #include "support/FileName.h"
16
17 #include <map>
18 #include <vector>
19
20 namespace lyx {
21         
22 /**
23  *  This struct represents a particular LyX "module", which is a like a layout
24  *  file, except that it does not stand alone. In that sense, it is more like 
25  *  a LaTeX package, where a layout file corresponds to a LaTeX class.
26  */
27 struct LyXModule {
28         /// what appears in the ui
29         std::string name;
30         /// the filename, without any path
31         std::string filename;
32         /// a short description for use in the ui
33         std::string description;
34         /// the LaTeX packages on which this depends, if any (not implemented)
35         std::vector<std::string> packageList;
36         /// whether those packages are available (not implemented yet)
37         bool available;
38 };
39
40 typedef std::vector<LyXModule> LyXModuleList;
41
42 /**
43  *  The ModuleList represents the various LyXModule's that are available at
44  *  present.
45  */
46 class ModuleList {
47 public:
48         ///
49         ModuleList() {}
50         /// reads the modules from a file generated by configure.py
51         bool load();
52         /// add a module to the list
53         void addLayoutModule(std::string const & name,
54                 std::string const & filename, std::string const & description,
55                 std::vector<std::string> const & packages);
56         ///
57         LyXModuleList::const_iterator begin() const;
58         ///
59         LyXModuleList::iterator begin();
60         ///
61         LyXModuleList::const_iterator end() const;
62         ///
63         LyXModuleList::iterator end();
64         ///
65         bool empty() const { return modlist_.empty(); }
66         /// Returns a pointer to the LyXModule with name str.
67         /// Returns a null pointer if no such module is found.
68         LyXModule * operator[](std::string const & str);
69 private:
70         /// noncopyable
71         ModuleList(ModuleList const &);
72         void operator=(ModuleList const &);
73
74         ///
75         std::vector<LyXModule> modlist_;
76 };
77
78 extern ModuleList moduleList;
79 }
80 #endif