]> git.lyx.org Git - lyx.git/blob - src/Author.h
Remove updateInfo() calls in favor of doing the relevant work
[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() : used_(false), buffer_id_(0) {};
26         ///
27         Author(docstring const & name, docstring const & email);
28         /// For when the \author line is missing (#9854)
29         Author(int buffer_id);
30         ///
31         docstring name() const { return name_; }
32         ///
33         docstring email() const { return email_; }
34         ///
35         docstring nameAndEmail() const;
36         ///
37         int bufferId() const { return buffer_id_; }
38         ///
39         void setBufferId(int buffer_id) const { buffer_id_ = buffer_id; }
40         ///
41         void setUsed(bool u) const { used_ = u; }
42         ///
43         bool used() const { return used_; }
44         /// Was the author line not missing?
45         bool valid() const;
46         ///
47         friend std::istream & operator>>(std::istream & os, Author & a);
48         ///
49         friend std::ostream & operator<<(std::ostream & os, Author const & a);
50
51 private:
52         /// The author's name
53         docstring name_;
54         /// The author's email address
55         docstring email_;
56         ///
57         mutable bool used_;
58         /// The id of the author in the lyx-file
59         mutable int buffer_id_;
60 };
61
62
63 class AuthorList {
64 public:
65         ///
66         AuthorList();
67         ///
68         int record(Author const & a);
69         ///
70         void record(int id, Author const & a);
71         ///
72         void recordCurrentAuthor(Author const & a);
73         ///
74         Author const & get(int id) const;
75         ///
76         void sort();
77         ///
78         typedef std::vector<Author> Authors;
79         ///
80         Authors::const_iterator begin() const;
81         ///
82         Authors::const_iterator end() const;
83         ///
84         friend
85         std::ostream & operator<<(std::ostream & os, AuthorList const & a);
86 private:
87         ///
88         Authors authors_;
89 };
90
91 bool operator==(Author const & l, Author const & r);
92
93 std::ostream & operator<<(std::ostream & os, Author const & a);
94
95 std::istream & operator>>(std::istream & os, Author & a);
96
97
98 } // namespace lyx
99
100 #endif // AUTHOR_H