]> git.lyx.org Git - lyx.git/blob - src/author.h
add comment
[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) {}
30
31         docstring const name() const {
32                 return name_;
33         }
34
35         docstring const email() const {
36                 return email_;
37         }
38
39         friend std::istream & operator>>(std::istream & os, Author & a);
40
41 private:
42         docstring name_;
43
44         docstring email_;
45 };
46
47
48 class AuthorList {
49 public:
50         AuthorList();
51
52         int record(Author const & a);
53
54         void record(int id, Author const & a);
55
56         Author const & get(int id);
57
58         typedef std::map<int, Author> Authors;
59
60         Authors::const_iterator begin() const;
61
62         Authors::const_iterator end() const;
63
64 private:
65         int last_id_;
66
67         Authors authors_;
68 };
69
70 bool operator==(Author const & l, Author const & r);
71
72 std::ostream & operator<<(std::ostream & os, Author const & a);
73
74 std::istream & operator>>(std::istream & os, Author & a);
75
76
77 } // namespace lyx
78
79 #endif // AUTHOR_H