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"
29 bool operator==(Author
const & l
, Author
const & r
)
31 return l
.name() == r
.name() && l
.email() == r
.email();
35 std::ostream
& operator<<(std::ostream
& os
, Author
const & a
)
38 os
<< "\"" << to_utf8(a
.name()) << "\" " << to_utf8(a
.email());
42 std::istream
& operator>>(std::istream
& is
, Author
& a
)
47 a
.name_
= from_utf8(trim(token(s
, '\"', 1)));
48 a
.email_
= from_utf8(trim(token(s
, '\"', 2)));
53 AuthorList::AuthorList()
59 int AuthorList::record(Author
const & a
)
61 Authors::const_iterator
it(authors_
.begin());
62 Authors::const_iterator
itend(authors_
.end());
64 for (; it
!= itend
; ++it
) {
69 authors_
[last_id_
++] = a
;
74 void AuthorList::record(int id
, Author
const & a
)
76 BOOST_ASSERT(unsigned(id
) < authors_
.size());
82 Author
const & AuthorList::get(int id
) const
84 Authors::const_iterator
it(authors_
.find(id
));
85 BOOST_ASSERT(it
!= authors_
.end());
90 AuthorList::Authors::const_iterator
AuthorList::begin() const
92 return authors_
.begin();
96 AuthorList::Authors::const_iterator
AuthorList::end() const
98 return authors_
.end();