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/std_istream.h"
16 #include "support/lstrings.h"
18 #include <boost/assert.hpp>
21 using namespace lyx::support;
23 bool operator==(Author const & l, Author const & r)
25 return l.name() == r.name() && l.email() == r.email();
29 std::ostream & operator<<(std::ostream & os, Author const & a)
31 os << "\"" << a.name() << "\" " << a.email();
35 std::istream & operator>>(std::istream & is, Author & a)
39 a.name_ = trim(token(s, '\"', 1));
40 a.email_ = trim(token(s, '\"', 2));
45 AuthorList::AuthorList()
51 int AuthorList::record(Author const & a)
53 Authors::const_iterator it(authors_.begin());
54 Authors::const_iterator itend(authors_.end());
56 for (; it != itend; ++it) {
61 authors_[last_id_++] = a;
66 void AuthorList::record(int id, Author const & a)
68 BOOST_ASSERT(unsigned(id) < authors_.size());
74 Author const & AuthorList::get(int id)
76 Authors::const_iterator it(authors_.find(id));
77 BOOST_ASSERT(it != authors_.end());
82 AuthorList::Authors::const_iterator AuthorList::begin() const
84 return authors_.begin();
88 AuthorList::Authors::const_iterator AuthorList::end() const
90 return authors_.end();