]> git.lyx.org Git - lyx.git/blob - src/TextClassList.h
cleanups
[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 #include "support/types.h"
19
20 #include <vector>
21
22
23 namespace lyx {
24
25 class Layout;
26
27 /// Reads the style files
28 extern bool LyXSetStyle();
29
30 ///
31 class TextClassList {
32 public:
33         ///
34         typedef std::vector<TextClass> ClassList;
35         ///
36         typedef ClassList::const_iterator const_iterator;
37         ///
38         const_iterator begin() const { return classlist_.begin(); }
39         ///
40         const_iterator end() const { return classlist_.end(); }
41         ///
42         bool empty() const { return classlist_.empty(); }
43
44         /// Gets textclass number from name, -1 if textclass name does not exist
45         std::pair<bool, textclass_type> const
46         numberOfClass(std::string const & textclass) const;
47
48         ///
49         TextClass const & operator[](textclass_type textclass) const;
50
51         /// Read textclass list.  Returns false if this fails.
52         bool read();
53         
54         /// Clears the textclass so as to force it to be reloaded
55         void reset(textclass_type const textclass);
56
57         /// add a textclass from user local directory.
58         /// Return ture/false, and textclass number
59         std::pair<bool, textclass_type> const
60         addTextClass(std::string const & textclass, std::string const & path);
61
62 private:
63         /// noncopyable
64         TextClassList(TextClassList const &);
65         void operator=(TextClassList const &);
66
67         ///
68         mutable ClassList classlist_;
69 };
70
71 ///
72 extern TextClassList textclasslist;
73 ///
74 textclass_type defaultTextclass();
75
76
77 } // namespace lyx
78
79 #endif