Another minor change, but this should almost get us to the point that we
[lyx.git] / src / Author.h
blob3bfefaaba0022d46f097337fcc7abf480530a580
1 // -*- C++ -*-
2 /**
3 * \file Author.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author John Levon
9 * Full author contact details are available in file CREDITS.
12 #ifndef AUTHOR_H
13 #define AUTHOR_H
15 #include "support/docstring.h"
17 #include <vector>
20 namespace lyx {
22 class Author {
23 public:
24 ///
25 Author() {}
26 ///
27 Author(docstring const & name, docstring const & email)
28 : name_(name), email_(email), used_(true), buffer_id_(0) {}
29 ///
30 docstring name() const { return name_; }
31 ///
32 docstring email() const { return email_; }
33 ///
34 unsigned int buffer_id() const { return buffer_id_; }
35 ///
36 void setBufferId(unsigned int buffer_id) const { buffer_id_ = buffer_id; }
37 ///
38 void setUsed(bool u) const { used_ = u; }
39 ///
40 bool used() const { return used_; }
41 ///
42 friend std::istream & operator>>(std::istream & os, Author & a);
44 private:
45 /// The author's name
46 docstring name_;
47 /// The author's email address
48 docstring email_;
49 ///
50 mutable bool used_;
51 /// The id of the author in the lyx-file
52 mutable unsigned int buffer_id_;
56 class AuthorList {
57 public:
58 ///
59 AuthorList();
60 ///
61 int record(Author const & a);
62 ///
63 void record(int id, Author const & a);
64 ///
65 Author const & get(int id) const;
66 ///
67 typedef std::vector<Author> Authors;
68 ///
69 void sort();
70 ///
71 Authors::const_iterator begin() const;
72 ///
73 Authors::const_iterator end() const;
74 ///
75 friend
76 std::ostream & operator<<(std::ostream & os, AuthorList const & a);
77 private:
78 ///
79 int last_id_;
80 ///
81 Authors authors_;
84 bool operator==(Author const & l, Author const & r);
86 std::ostream & operator<<(std::ostream & os, Author const & a);
88 std::istream & operator>>(std::istream & os, Author & a);
91 } // namespace lyx
93 #endif // AUTHOR_H