4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
6 * \author Jürgen Spitzmüller
8 * Full author contact details are available in file CREDITS.
13 * A class describing an Index type, such as "Index of Names".
14 * Different Index types are used in splitted Indices
16 * An Index has a name and a shortcut notation. It uses a
17 * user-specifyable GUI colour. All these can be set and
22 * A class containing a vector of all defined indices within a
23 * document. Has methods for outputting a '|'-separated string
24 * of all elements, and for adding, removing and renaming elements.
31 #include "ColorCode.h"
33 #include "support/docstring.h"
45 docstring
const & index() const;
47 void setIndex(docstring
const &);
49 docstring
const & shortcut() const;
51 void setShortcut(docstring
const &);
53 RGBColor
const & color() const;
55 void setColor(RGBColor
const &);
57 * Set color from a string "#rrggbb".
58 * Use Color:background if the string is no valid color.
59 * This ensures compatibility with LyX 1.4.0 that had the symbolic
60 * color "none" that was displayed as Color:background.
62 void setColor(std::string
const &);
76 typedef std::list
<Index
> List
;
78 typedef List::const_iterator const_iterator
;
81 IndicesList() : separator_(from_ascii("|")) {}
84 bool empty() const { return list
.empty(); }
86 void clear() { list
.clear(); }
88 const_iterator
begin() const { return list
.begin(); }
89 const_iterator
end() const { return list
.end(); }
91 /** \returns the Index with \c name. If not found, returns 0.
93 Index
* find(docstring
const & name
);
94 Index
const * find(docstring
const & name
) const;
96 /** \returns the Index with the shortcut \c shortcut.
97 * If not found, returns 0.
99 Index
* findShortcut(docstring
const & shortcut
);
100 Index
const * findShortcut(docstring
const & shortcut
) const;
102 /** Add (possibly multiple (separated by separator())) indices to list
103 * \returns true if an index is added.
105 bool add(docstring
const & n
, docstring
const & s
= docstring());
106 /** Add the default index (if not already there)
107 * \returns true if an index is added.
109 bool addDefault(docstring
const & n
);
110 /** remove an index from list by name
111 * \returns true if an index is removed.
113 bool remove(docstring
const &);
114 /** rename an index in list
115 * \returns true if renaming succeeded.
117 bool rename(docstring
const &, docstring
const &);
123 docstring separator_
;
128 #endif // INDICESLIST_H