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