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;
27 bool operator==(Author const & l, Author const & r)
29 return l.name() == r.name() && l.email() == r.email();
33 std::ostream & operator<<(std::ostream & os, Author const & a)
35 os << "\"" << a.name() << "\" " << a.email();
39 std::istream & operator>>(std::istream & is, Author & a)
43 a.name_ = trim(token(s, '\"', 1));
44 a.email_ = trim(token(s, '\"', 2));
49 AuthorList::AuthorList()
55 int AuthorList::record(Author const & a)
57 Authors::const_iterator it(authors_.begin());
58 Authors::const_iterator itend(authors_.end());
60 for (; it != itend; ++it) {
65 authors_[last_id_++] = a;
70 void AuthorList::record(int id, Author const & a)
72 BOOST_ASSERT(unsigned(id) < authors_.size());
78 Author const & AuthorList::get(int id)
80 Authors::const_iterator it(authors_.find(id));
81 BOOST_ASSERT(it != authors_.end());
86 AuthorList::Authors::const_iterator AuthorList::begin() const
88 return authors_.begin();
92 AuthorList::Authors::const_iterator AuthorList::end() const
94 return authors_.end();