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();
30 /// Index into BaseClassList. Basically a 'strong typedef'.
31 class BaseClassIndex {
34 typedef std::string base_type;
36 BaseClassIndex(base_type t) { data_ = t; }
38 operator base_type() const { return data_; }
45 /// A list of base document classes (*.layout files).
46 /// This is a singleton class. The sole instance is accessed
47 /// via BaseClassList::get()
52 /// \return The sole instance of this class.
53 static BaseClassList & get();
55 bool empty() const { return classmap_.empty(); }
57 bool haveClass(std::string const & classname) const;
59 TextClass const & operator[](std::string const & classname) const;
60 /// Read textclass list. Returns false if this fails.
62 /// Clears the textclass so as to force it to be reloaded
63 void reset(BaseClassIndex const & tc);
64 /// add a textclass from user local directory.
65 /// \return the identifier for the loaded file, or else an
66 /// empty string if no file was loaded.
68 addTextClass(std::string const & textclass, std::string const & path);
69 /// a list of the available classes
70 std::vector<BaseClassIndex> classList() const;
72 static std::string const localPrefix;
75 typedef std::map<std::string, TextClass> ClassMap;
77 BaseClassList(BaseClassList const &);
79 void operator=(BaseClassList const &);
81 mutable ClassMap classmap_; //FIXME
85 BaseClassIndex defaultBaseclass();