]> git.lyx.org Git - features.git/blob - src/ModuleList.h
This is one of a series of patches that will merge the layout modules development...
[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 <vector>
16 #include "support/FileName.h"
17
18 #include <boost/utility.hpp>
19
20 #include <map>
21
22 namespace lyx {
23         
24         /**
25          *  This struct represents a particular LyX "module", which is a like a layout
26          *  file, except that it does not stand alone. In that sense, it is more like 
27          *  a LaTeX package, where a layout file corresponds to a LaTeX class.
28          */
29         struct LyXModule {
30                 /// what appears in the ui
31                 std::string name;
32                 /// the filename, without any path
33                 std::string filename;
34                 /// a short description for use in the ui
35                 std::string description;
36                 /// the LaTeX packages on which this depends, if any (not implemented)
37                 //std::vector<std::string> packageList;
38                 /// whether those packages are available (not implemented yet)
39                 //bool available;
40         };
41         
42         typedef std::vector<LyXModule> LyXModuleList;
43         
44         /**
45          *  The ModuleList represents the various LyXModule's that are available at
46          *  present.
47          */
48         class ModuleList : boost::noncopyable {
49                 public:
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 name, std::string filename, 
54                                              std::string description);
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() { 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 str);
68                 private:
69                         std::vector<LyXModule> modlist_;
70         };
71
72         extern ModuleList moduleList;
73 }
74 #endif