]> git.lyx.org Git - lyx.git/blob - src/Author.h
0f1e49e7a7ee8fd209c9c8af6e4e6371a8d88128
[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 <map>
18
19
20 namespace lyx {
21
22 class Author {
23 public:
24         ///
25         Author() {}
26         ///
27         Author(docstring const & name, docstring const & email)
28                 : name_(name), email_(email), used_(true) {}
29         ///
30         docstring name() const { return name_; }
31         ///
32         docstring email() const { return email_; }
33         ///
34         void setUsed(bool u) const { used_ = u; }
35         ///
36         bool used() const { return used_; }
37         ///
38         friend std::istream & operator>>(std::istream & os, Author & a);
39
40 private:
41         /// The author's name
42         docstring name_;
43         /// The author's email address
44         docstring email_;
45         ///
46         mutable bool used_;
47 };
48
49
50 class AuthorList {
51 public:
52         ///
53         AuthorList();
54         ///
55         int record(Author const & a);
56         ///
57         void record(int id, Author const & a);
58         ///
59         Author const & get(int id) const;
60         ///
61         typedef std::map<int, Author> Authors;
62         ///
63         Authors::const_iterator begin() const;
64         ///
65         Authors::const_iterator end() const;
66         ///
67 private:
68         ///
69         int last_id_;
70         ///
71         Authors authors_;
72 };
73
74 bool operator==(Author const & l, Author const & r);
75
76 std::ostream & operator<<(std::ostream & os, Author const & a);
77
78 std::istream & operator>>(std::istream & os, Author & a);
79
80
81 } // namespace lyx
82
83 #endif // AUTHOR_H