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