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