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