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).
49 typedef std::vector<TextClass> ClassList;
51 typedef ClassList::const_iterator const_iterator;
53 const_iterator begin() const { return classlist_.begin(); }
55 const_iterator end() const { return classlist_.end(); }
57 bool empty() const { return classlist_.empty(); }
59 /// Gets textclass number from name, -1 if textclass name does not exist
60 std::pair<bool, BaseClassIndex> const
61 numberOfClass(std::string const & textclass) const;
64 TextClass const & operator[](BaseClassIndex textclass) const;
66 /// Read textclass list. Returns false if this fails.
69 /// Clears the textclass so as to force it to be reloaded
70 void reset(BaseClassIndex const textclass);
72 /// add a textclass from user local directory.
73 /// Return ture/false, and textclass number
74 std::pair<bool, BaseClassIndex> const
75 addTextClass(std::string const & textclass, std::string const & path);
79 BaseClassList(BaseClassList const &);
81 void operator=(BaseClassList const &);
84 mutable ClassList classlist_;
88 extern BaseClassList baseclasslist;
90 BaseClassIndex defaultBaseclass();