]> git.lyx.org Git - lyx.git/blob - src/ModuleList.h
* BufferView::updateMetrics(): split up the method in two for the SinglePar case.
[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 <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                                              std::vector<std::string> packages);
56                         ///
57                         LyXModuleList::const_iterator begin() const;
58                         ///
59                         LyXModuleList::iterator begin();
60                         ///
61                         LyXModuleList::const_iterator end() const;
62                         ///
63                         LyXModuleList::iterator end();
64                         ///
65                         bool empty() { return modlist_.empty(); };
66                         /// Returns a pointer to the LyXModule with name str.
67                         /// Returns a null pointer if no such module is found.
68                         LyXModule * operator[](std::string str);
69                 private:
70                         std::vector<LyXModule> modlist_;
71         };
72
73         extern ModuleList moduleList;
74 }
75 #endif