]> git.lyx.org Git - lyx.git/blob - src/Author.h
d62fcb007019d22c3199597abac6d8419686e93e
[lyx.git] / src / Author.h
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.
6  *
7  * \author John Levon
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef AUTHOR_H
13 #define AUTHOR_H
14
15 #include "support/docstring.h"
16
17 #include <vector>
18
19
20 namespace lyx {
21
22 class Author {
23 public:
24         ///
25         Author() {}
26         ///
27         Author(docstring const & name, docstring const & email);
28         ///
29         docstring name() const { return name_; }
30         ///
31         docstring email() const { return email_; }
32         ///
33         int bufferId() const { return buffer_id_; }
34         ///
35         void setBufferId(int buffer_id) const { buffer_id_ = buffer_id; }
36         ///
37         void setUsed(bool u) const { used_ = u; }
38         ///
39         bool used() const { return used_; }
40         ///
41         friend std::istream & operator>>(std::istream & os, Author & a);
42         ///
43         friend std::ostream & operator<<(std::ostream & os, Author const & a);
44
45 private:
46         /// The author's name
47         docstring name_;
48         /// The author's email address
49         docstring email_;
50         ///
51         mutable bool used_;
52         /// The id of the author in the lyx-file
53         mutable int buffer_id_;
54 };
55
56
57 class AuthorList {
58 public:
59         ///
60         AuthorList();
61         ///
62         int record(Author const & a);
63         ///
64         void record(int id, Author const & a);
65         ///
66         void recordCurrentAuthor(Author const & a);
67         ///
68         Author const & get(int id) const;
69         ///
70         void sort();
71         ///
72         typedef std::vector<Author> Authors;
73         ///
74         Authors::const_iterator begin() const;
75         ///
76         Authors::const_iterator end() const;
77         ///
78         friend
79         std::ostream & operator<<(std::ostream & os, AuthorList const & a);
80 private:
81         ///
82         int last_id_;
83         ///
84         Authors authors_;
85 };
86
87 bool operator==(Author const & l, Author const & r);
88
89 std::ostream & operator<<(std::ostream & os, Author const & a);
90
91 std::istream & operator>>(std::istream & os, Author & a);
92
93
94 } // namespace lyx
95
96 #endif // AUTHOR_H