]> git.lyx.org Git - lyx.git/blob - src/ModuleList.h
document my LFUN changes in the past
[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 <map>
16 #include <string>
17 #include <vector>
18
19 namespace lyx {
20         
21 /**
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.
25  */
26 struct LyXModule {
27         /// what appears in the ui
28         std::string name;
29         /// the filename, without any path
30         std::string filename;
31         /// a short description for use in the ui
32         std::string description;
33         /// the LaTeX packages on which this depends, if any (not implemented)
34         std::vector<std::string> packageList;
35         /// whether those packages are available (not implemented yet)
36         bool available;
37 };
38
39 typedef std::vector<LyXModule> LyXModuleList;
40
41 /**
42  *  The ModuleList represents the various LyXModule's that are available at
43  *  present.
44  */
45 class ModuleList {
46 public:
47         ///
48         ModuleList() {}
49         /// reads the modules from a file generated by configure.py
50         bool load();
51         /// add a module to the list
52         void addLayoutModule(std::string const & name,
53                 std::string const & filename, std::string const & description,
54                 std::vector<std::string> const & packages);
55         ///
56         LyXModuleList::const_iterator begin() const;
57         ///
58         LyXModuleList::iterator begin();
59         ///
60         LyXModuleList::const_iterator end() const;
61         ///
62         LyXModuleList::iterator end();
63         ///
64         bool empty() const { return modlist_.empty(); }
65         /// Returns a pointer to the LyXModule with name str.
66         /// Returns a null pointer if no such module is found.
67         LyXModule * operator[](std::string const & str);
68 private:
69         /// noncopyable
70         ModuleList(ModuleList const &);
71         void operator=(ModuleList const &);
72
73         ///
74         std::vector<LyXModule> modlist_;
75 };
76
77 extern ModuleList moduleList;
78 }
79 #endif