4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Martin Vermeer
9 * Full author contact details are available in file CREDITS.
15 #include "ColorCode.h"
17 #include "support/docstring.h"
27 * A class describing a 'branch', i.e., a named alternative for
28 * selectively outputting some parts of a document while suppressing
31 * A branch has a name, can either be selected or not, and uses a
32 * user-specifiable background colour. All these can be set and
37 * A class containing a vector of all defined branches within a
38 * document. It has methods for selecting or deselecting branches by
39 * name, for outputting a '|'-separated string of all elements or only
40 * the selected ones, and for adding and removing elements.
48 docstring const & branch() const;
50 void setBranch(docstring const &);
52 bool isSelected() const;
53 /** Select/deselect the branch.
54 * \return true if the selection status changes.
56 bool setSelected(bool);
57 /** If true, the branch name will be appended
58 * to the output file name.
60 bool hasFileNameSuffix() const;
61 /// Select/deselect filename suffix property.
62 void setFileNameSuffix(bool);
64 RGBColor const & color() const;
66 void setColor(RGBColor const &);
68 * Set color from a string "#rrggbb".
69 * Use Color:background if the string is no valid color.
70 * This ensures compatibility with LyX 1.4.0 that had the symbolic
71 * color "none" that was displayed as Color:background.
73 void setColor(std::string const &);
89 typedef std::list<Branch> List;
91 typedef List::const_iterator const_iterator;
94 BranchList() : separator_(from_ascii("|")) {}
97 docstring separator() const { return separator_; }
100 bool empty() const { return list.empty(); }
102 void clear() { list.clear(); }
104 const_iterator begin() const { return list.begin(); }
105 const_iterator end() const { return list.end(); }
107 /** \returns the Branch with \c name. If not found, returns 0.
109 Branch * find(docstring const & name);
110 Branch const * find(docstring const & name) const;
112 /** Add (possibly multiple (separated by separator())) branches to list
113 * \returns true if a branch is added.
115 bool add(docstring const &);
116 /** remove a branch from list by name
117 * \returns true if a branch is removed.
119 bool remove(docstring const &);
120 /** rename an branch in list
121 * \returns true if renaming succeeded.
122 * if \p merge is true, the branch will be removed
123 * if a branch with the newname already exists.
125 bool rename(docstring const &, docstring const &, bool const merge = false);
126 /// get the complete filename suffix
127 docstring getFileNameSuffix() const;
133 docstring separator_;
138 #endif // BRANCHLIST_H