3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Martin Vermeer
8 * Full author contact details are available in file CREDITS.
13 #include "BranchList.h"
19 string const & Branch::getBranch() const
25 void Branch::setBranch(string const & s)
31 bool Branch::getSelected() const
37 bool Branch::setSelected(bool b)
46 string const & Branch::getColor() const
52 void Branch::setColor(string const & c)
58 Branch * BranchList::find(std::string const & name)
61 std::find_if(list.begin(), list.end(), BranchNamesEqual(name));
62 return it == list.end() ? 0 : &*it;
66 Branch const * BranchList::find(std::string const & name) const
68 List::const_iterator it =
69 std::find_if(list.begin(), list.end(), BranchNamesEqual(name));
70 return it == list.end() ? 0 : &*it;
74 bool BranchList::add(string const & s)
77 string::size_type i = 0;
79 string::size_type const j = s.find_first_of(separator_, i);
81 if (j == string::npos)
84 name = s.substr(i, j - i);
85 // Is this name already in the list?
87 std::find_if(list.begin(), list.end(),
88 BranchNamesEqual(name)) != list.end();
93 br.setSelected(false);
97 if (j == string::npos)
105 bool BranchList::remove(string const & s)
107 List::size_type const size = list.size();
108 list.remove_if(BranchNamesEqual(s));
109 return size != list.size();