3 * \file BaseClassList.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Lars Gullik Bjønnes
9 * Full author contact details are available in file CREDITS.
12 #ifndef BASECLASSLIST_H
13 #define BASECLASSLIST_H
15 #include "TextClass.h"
17 #include "support/strfwd.h"
26 /// Reads the style files
27 extern bool LyXSetStyle();
29 /// Index into BaseClassList. Basically a 'strong typedef'.
30 class BaseClassIndex {
33 typedef size_t base_type;
35 BaseClassIndex(base_type t) { data_ = t; }
37 operator base_type() const { return data_; }
43 /// A list of base document classes (*.layout files).
44 /// This is a singleton class. The sole instance is accessed
45 /// via BaseClassList::get()
50 /// \return The sole instance of this class.
51 static BaseClassList & get();
53 typedef std::vector<TextClass> ClassList;
55 typedef ClassList::const_iterator const_iterator;
57 const_iterator begin() const { return classlist_.begin(); }
59 const_iterator end() const { return classlist_.end(); }
61 bool empty() const { return classlist_.empty(); }
63 /// Gets textclass number from name, -1 if textclass name does not exist
64 std::pair<bool, BaseClassIndex> const
65 numberOfClass(std::string const & textclass) const;
68 TextClass const & operator[](BaseClassIndex textclass) const;
70 /// Read textclass list. Returns false if this fails.
73 /// Clears the textclass so as to force it to be reloaded
74 void reset(BaseClassIndex const textclass);
76 /// add a textclass from user local directory.
77 /// Return ture/false, and textclass number
78 std::pair<bool, BaseClassIndex> const
79 addTextClass(std::string const & textclass, std::string const & path);
83 BaseClassList(BaseClassList const &);
85 void operator=(BaseClassList const &);
88 mutable ClassList classlist_;
92 BaseClassIndex defaultBaseclass();