]> git.lyx.org Git - features.git/blob - src/ModuleList.h
Thanks, Angus.
[features.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
27 //FIXME Give us some access functions here.
28 class LyXModule {
29 public:
30         ///
31         LyXModule(std::string n, std::string f, std::string d,
32                   std::vector<std::string> p);
33         /// whether the required packages are available
34         bool isAvailable();
35         /// what appears in the ui
36         std::string name;
37         /// the filename, without any path
38         std::string filename;
39         /// a short description for use in the ui
40         std::string description;
41         /// the LaTeX packages on which this depends, if any (not implemented)
42         std::vector<std::string> packageList;
43 private:
44         ///
45         bool checked;
46         ///
47         bool available;
48 };
49
50 typedef std::vector<LyXModule> LyXModuleList;
51
52 /**
53  *  The ModuleList represents the various LyXModule's that are available at
54  *  present.
55  */
56 class ModuleList {
57 public:
58         ///
59         ModuleList() {}
60         /// reads the modules from a file generated by configure.py
61         bool load();
62         /// add a module to the list
63         void addLayoutModule(std::string const & name,
64                 std::string const & filename, std::string const & description,
65                 std::vector<std::string> const & packages);
66         ///
67         LyXModuleList::const_iterator begin() const;
68         ///
69         LyXModuleList::iterator begin();
70         ///
71         LyXModuleList::const_iterator end() const;
72         ///
73         LyXModuleList::iterator end();
74         ///
75         bool empty() const { return modlist_.empty(); }
76         /// Returns a pointer to the LyXModule with name str.
77         /// Returns a null pointer if no such module is found.
78         LyXModule * operator[](std::string const & str);
79 private:
80         /// noncopyable
81         ModuleList(ModuleList const &);
82         void operator=(ModuleList const &);
83
84         ///
85         std::vector<LyXModule> modlist_;
86 };
87
88 extern ModuleList moduleList;
89 }
90 #endif