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/LOstream.h"
17 #include "support/LIstream.h"
18 #include "support/lstrings.h"
20 using namespace lyx::support;
22 bool operator==(Author const & l, Author const & r)
24 return l.name() == r.name() && l.email() == r.email();
28 std::ostream & operator<<(std::ostream & os, Author const & a)
30 os << "\"" << a.name() << "\" " << a.email();
34 std::istream & operator>>(std::istream & is, Author & a)
38 a.name_ = trim(token(s, '\"', 1));
39 a.email_ = trim(token(s, '\"', 2));
44 AuthorList::AuthorList()
50 int AuthorList::record(Author const & a)
52 Authors::const_iterator it(authors_.begin());
53 Authors::const_iterator itend(authors_.end());
55 for (; it != itend; ++it) {
60 authors_[last_id_++] = a;
65 void AuthorList::record(int id, Author const & a)
67 Assert(unsigned(id) < authors_.size());
73 Author const & AuthorList::get(int id)
75 Authors::const_iterator it(authors_.find(id));
76 Assert(it != authors_.end());
81 AuthorList::Authors::const_iterator AuthorList::begin() const
83 return authors_.begin();
87 AuthorList::Authors::const_iterator AuthorList::end() const
89 return authors_.end();