X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FAuthor.cpp;h=6c608327e135c0d2e12ecc25569a2059af2ac640;hb=4db3e641ed6765e005343010cb90ee8af26f8f99;hp=08349265009da4d6124626b13e1dede3310f1a70;hpb=56faf7474c7386c280e317d14ce32c9aa5fc1f3a;p=lyx.git diff --git a/src/Author.cpp b/src/Author.cpp index 0834926500..6c608327e1 100644 --- a/src/Author.cpp +++ b/src/Author.cpp @@ -51,12 +51,13 @@ bool operator==(Author const & l, Author const & r) ostream & operator<<(ostream & os, Author const & a) { // FIXME UNICODE - os << a.buffer_id() << " \"" << to_utf8(a.name()) - << "\" " << to_utf8(a.email()); - + os << a.buffer_id_ << " \"" << to_utf8(a.name_) + << "\" " << to_utf8(a.email_); + return os; } + istream & operator>>(istream & is, Author & a) { string s; @@ -69,15 +70,15 @@ istream & operator>>(istream & is, Author & a) } -bool author_smaller(Author const & lhs, Author const & rhs) { - return lhs.buffer_id() < rhs.buffer_id(); +bool author_smaller(Author const & lhs, Author const & rhs) +{ + return lhs.bufferId() < rhs.bufferId(); } AuthorList::AuthorList() : last_id_(0) -{ -} +{} int AuthorList::record(Author const & a) @@ -85,8 +86,8 @@ int AuthorList::record(Author const & a) // If we record an author which equals the current // author, we copy the buffer_id, so that it will // keep the same id in the file. - if (authors_.size() > 0 && a == authors_[0]) - authors_[0].setBufferId(a.buffer_id()); + if (!authors_.empty() && a == authors_[0]) + authors_[0].setBufferId(a.bufferId()); Authors::const_iterator it(authors_.begin()); Authors::const_iterator itend(authors_.end()); @@ -101,6 +102,7 @@ int AuthorList::record(Author const & a) void AuthorList::record(int id, Author const & a) { + // LASSERT: What should we do here? LASSERT(unsigned(id) < authors_.size(), /**/); authors_[id] = a; @@ -116,6 +118,7 @@ void AuthorList::recordCurrentAuthor(Author const & a) Author const & AuthorList::get(int id) const { + // LASSERT: What should we do here? LASSERT(id < (int)authors_.size() , /**/); return authors_[id]; } @@ -133,12 +136,14 @@ AuthorList::Authors::const_iterator AuthorList::end() const } -void AuthorList::sort() { +void AuthorList::sort() +{ std::sort(authors_.begin(), authors_.end(), author_smaller); } -ostream & operator<<(ostream & os, AuthorList const & a) { +ostream & operator<<(ostream & os, AuthorList const & a) +{ // Copy the authorlist, because we don't want to sort the original AuthorList sorted = a; sorted.sort();