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/LAssert.h"
16 #include "support/LIstream.h"
17 #include "support/lstrings.h"
19 using namespace lyx::support;
21 bool operator==(Author const & l, Author const & r)
23 return l.name() == r.name() && l.email() == r.email();
27 std::ostream & operator<<(std::ostream & os, Author const & a)
29 os << "\"" << a.name() << "\" " << a.email();
33 std::istream & operator>>(std::istream & is, Author & a)
37 a.name_ = trim(token(s, '\"', 1));
38 a.email_ = trim(token(s, '\"', 2));
43 AuthorList::AuthorList()
49 int AuthorList::record(Author const & a)
51 Authors::const_iterator it(authors_.begin());
52 Authors::const_iterator itend(authors_.end());
54 for (; it != itend; ++it) {
59 authors_[last_id_++] = a;
64 void AuthorList::record(int id, Author const & a)
66 Assert(unsigned(id) < authors_.size());
72 Author const & AuthorList::get(int id)
74 Authors::const_iterator it(authors_.find(id));
75 Assert(it != authors_.end());
80 AuthorList::Authors::const_iterator AuthorList::begin() const
82 return authors_.begin();
86 AuthorList::Authors::const_iterator AuthorList::end() const
88 return authors_.end();