]> git.lyx.org Git - lyx.git/blob - src/Author.h
* Get rid of LFUN_TOC_INSERT: we use LFUN_INSET_INSERT "toc".
[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() {}
26         ///
27         Author(docstring const & name, docstring const & email)
28                 : name_(name), email_(email), used_(true), buffer_id_(0) {}
29         ///
30         docstring name() const { return name_; }
31         ///
32         docstring email() const { return email_; }
33         ///
34         unsigned int buffer_id() const { return buffer_id_; }
35         ///
36         void setBufferId(unsigned int buffer_id) const { buffer_id_ = buffer_id; }
37         ///
38         void setUsed(bool u) const { used_ = u; }
39         ///
40         bool used() const { return used_; }
41         ///
42         friend std::istream & operator>>(std::istream & os, Author & a);
43
44 private:
45         /// The author's name
46         docstring name_;
47         /// The author's email address
48         docstring email_;
49         ///
50         mutable bool used_;
51         /// The id of the author in the lyx-file
52         mutable unsigned int buffer_id_;
53 };
54
55
56 class AuthorList {
57 public:
58         ///
59         AuthorList();
60         ///
61         int record(Author const & a);
62         ///
63         void record(int id, Author const & a);
64         ///
65         Author const & get(int id) const;
66         ///
67         typedef std::vector<Author> Authors;
68         ///
69         void sort();
70         ///
71         Authors::const_iterator begin() const;
72         ///
73         Authors::const_iterator end() const;
74         ///
75         friend
76         std::ostream & operator<<(std::ostream & os, AuthorList const & a);
77 private:
78         ///
79         int last_id_;
80         ///
81         Authors authors_;
82 };
83
84 bool operator==(Author const & l, Author const & r);
85
86 std::ostream & operator<<(std::ostream & os, Author const & a);
87
88 std::istream & operator>>(std::istream & os, Author & a);
89
90
91 } // namespace lyx
92
93 #endif // AUTHOR_H