]> git.lyx.org Git - lyx.git/blob - src/ModuleList.h
english_language was not used at all.
[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
27 //FIXME Give us some access functions here.
28 class LyXModule {
29 public:
30         ///
31         LyXModule(std::string const & n, std::string const & i, 
32                   std::string const & d, std::vector<std::string> const & p,
33                   std::vector<std::string> const & r, 
34                   std::vector<std::string> const & e);
35         /// whether the required packages are available
36         bool isAvailable();
37         ///
38         std::string const & getName() const { return name; }
39         ///
40         std::string const & getID() const { return id; }
41         ///
42         std::string const & getFilename() const { return filename; }
43         ///
44         std::string const & getDescription() const { return description; }
45         ///
46         std::vector<std::string> const & getPackageList() const
47                 { return packageList; }
48         ///
49         std::vector<std::string> const & getRequiredModules() const 
50                 { return requiredModules; }
51         /// Modules this one excludes: the list should be treated disjunctively
52         std::vector<std::string> const & getExcludedModules() const 
53                 { return excludedModules; }
54         
55 private:
56         /// what appears in the ui
57         std::string name;
58         /// the module's unique identifier
59         /// at present, this is the filename, without the extension
60         std::string id;
61         /// the filename
62         std::string filename;
63         /// a short description for use in the ui
64         std::string description;
65         /// the LaTeX packages on which this depends, if any
66         std::vector<std::string> packageList;
67         /// Modules this one requires: at least one
68         std::vector<std::string> requiredModules;
69         /// Modules this one excludes: none of these
70         std::vector<std::string> excludedModules;
71         ///
72         bool checked;
73         ///
74         bool available;
75 };
76
77 typedef std::vector<LyXModule> LyXModuleList;
78
79 /**
80  *  The ModuleList represents the various LyXModule's that are available at
81  *  present.
82  */
83 class ModuleList {
84 public:
85         ///
86         ModuleList() {}
87         /// reads the modules from a file generated by configure.py
88         bool load();
89         ///
90         LyXModuleList::const_iterator begin() const;
91         ///
92         LyXModuleList::iterator begin();
93         ///
94         LyXModuleList::const_iterator end() const;
95         ///
96         LyXModuleList::iterator end();
97         ///
98         bool empty() const { return modlist_.empty(); }
99         /// Returns a pointer to the LyXModule with name str.
100         /// Returns a null pointer if no such module is found.
101         LyXModule * getModuleByName(std::string const & str);
102         /// Returns a pointer to the LyXModule with filename str.
103         /// Returns a null pointer if no such module is found.
104         LyXModule * operator[](std::string const & str);
105         private:
106         /// noncopyable
107         ModuleList(ModuleList const &);
108         ///
109         void operator=(ModuleList const &);
110         /// add a module to the list
111         void addLayoutModule(std::string const &, std::string const &, 
112                 std::string const &, std::vector<std::string> const &,
113                 std::vector<std::string> const &, std::vector<std::string> const &);
114         ///
115         std::vector<LyXModule> modlist_;
116 };
117
118 extern ModuleList moduleList;
119 }
120 #endif