]> git.lyx.org Git - lyx.git/blob - src/TextClassList.h
Restore Andre's TextClassIndex, but now in the form of BaseClassIndex. It seems worth...
[lyx.git] / src / TextClassList.h
1 // -*- C++ -*-
2 /**
3  * \file TextClassList.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Lars Gullik Bjønnes
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef TEXTCLASSLIST_H
13 #define TEXTCLASSLIST_H
14
15 #include "TextClass.h"
16
17 #include "support/strfwd.h"
18
19 #include <vector>
20
21
22 namespace lyx {
23
24 class Layout;
25
26 /// Reads the style files
27 extern bool LyXSetStyle();
28
29 ///
30 class TextClassList {
31 public:
32         ///
33         TextClassList() {}
34         ///
35         typedef std::vector<TextClass> ClassList;
36         ///
37         typedef ClassList::const_iterator const_iterator;
38         ///
39         const_iterator begin() const { return classlist_.begin(); }
40         ///
41         const_iterator end() const { return classlist_.end(); }
42         ///
43         bool empty() const { return classlist_.empty(); }
44
45         /// Gets textclass number from name, -1 if textclass name does not exist
46         std::pair<bool, BaseClassIndex> const
47                 numberOfClass(std::string const & textclass) const;
48
49         ///
50         TextClass const & operator[](BaseClassIndex textclass) const;
51
52         /// Read textclass list.  Returns false if this fails.
53         bool read();
54         
55         /// Clears the textclass so as to force it to be reloaded
56         void reset(BaseClassIndex const textclass);
57
58         /// add a textclass from user local directory.
59         /// Return ture/false, and textclass number
60         std::pair<bool, BaseClassIndex> const
61                 addTextClass(std::string const & textclass, std::string const & path);
62
63 private:
64         /// noncopyable
65         TextClassList(TextClassList const &);
66         /// nonassignable
67         void operator=(TextClassList const &);
68
69         ///
70         mutable ClassList classlist_;
71 };
72
73 ///
74 extern TextClassList textclasslist;
75 ///
76 BaseClassIndex defaultTextclass();
77
78
79 } // namespace lyx
80
81 #endif