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"
18 string const & Branch::getBranch() const
24 void Branch::setBranch(string const & s)
30 bool Branch::getSelected() const
36 bool Branch::setSelected(bool b)
45 string const & Branch::getColor() const
51 void Branch::setColor(string const & c)
57 Branch * BranchList::find(std::string const & name)
60 std::find_if(list.begin(), list.end(), BranchNamesEqual(name));
61 return it == list.end() ? 0 : &*it;
65 Branch const * BranchList::find(std::string const & name) const
67 List::const_iterator it =
68 std::find_if(list.begin(), list.end(), BranchNamesEqual(name));
69 return it == list.end() ? 0 : &*it;
73 bool BranchList::add(string const & s)
76 string::size_type i = 0;
78 string::size_type const j = s.find_first_of(separator_, i);
80 if (j == string::npos)
83 name = s.substr(i, j - i);
84 // Is this name already in the list?
86 std::find_if(list.begin(), list.end(),
87 BranchNamesEqual(name)) != list.end();
92 br.setSelected(false);
96 if (j == string::npos)
104 bool BranchList::remove(string const & s)
106 List::size_type const size = list.size();
107 list.remove_if(BranchNamesEqual(s));
108 return size != list.size();