3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
15 #include "support/lstrings.h"
17 #include <boost/assert.hpp>
19 #include "support/std_istream.h"
21 using lyx::support::token;
22 using lyx::support::trim;
25 bool operator==(Author const & l, Author const & r)
27 return l.name() == r.name() && l.email() == r.email();
31 std::ostream & operator<<(std::ostream & os, Author const & a)
33 os << "\"" << a.name() << "\" " << a.email();
37 std::istream & operator>>(std::istream & is, Author & a)
41 a.name_ = trim(token(s, '\"', 1));
42 a.email_ = trim(token(s, '\"', 2));
47 AuthorList::AuthorList()
53 int AuthorList::record(Author const & a)
55 Authors::const_iterator it(authors_.begin());
56 Authors::const_iterator itend(authors_.end());
58 for (; it != itend; ++it) {
63 authors_[last_id_++] = a;
68 void AuthorList::record(int id, Author const & a)
70 BOOST_ASSERT(unsigned(id) < authors_.size());
76 Author const & AuthorList::get(int id)
78 Authors::const_iterator it(authors_.find(id));
79 BOOST_ASSERT(it != authors_.end());
84 AuthorList::Authors::const_iterator AuthorList::begin() const
86 return authors_.begin();
90 AuthorList::Authors::const_iterator AuthorList::end() const
92 return authors_.end();