2003-08-23 00:17:00 +00:00
|
|
|
// -*- C++ -*-
|
2003-02-08 19:18:01 +00:00
|
|
|
/**
|
2007-04-26 04:41:58 +00:00
|
|
|
* \file Author.h
|
2003-02-08 19:18:01 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author John Levon
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2003-02-08 19:18:01 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef AUTHOR_H
|
|
|
|
#define AUTHOR_H
|
|
|
|
|
2006-12-21 13:58:28 +00:00
|
|
|
#include "support/docstring.h"
|
|
|
|
|
2003-02-08 19:18:01 +00:00
|
|
|
#include <map>
|
|
|
|
#include <iosfwd>
|
|
|
|
|
2003-03-04 09:27:27 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
namespace lyx {
|
|
|
|
|
|
|
|
|
2003-02-08 19:18:01 +00:00
|
|
|
class Author {
|
|
|
|
public:
|
|
|
|
Author() {}
|
2003-03-04 09:27:27 +00:00
|
|
|
|
2006-12-21 13:58:28 +00:00
|
|
|
Author(docstring const & name, docstring const & email)
|
2007-07-09 20:52:34 +00:00
|
|
|
: name_(name), email_(email), used_(true) {}
|
2003-02-08 19:18:01 +00:00
|
|
|
|
2006-12-21 13:58:28 +00:00
|
|
|
docstring const name() const {
|
2003-02-08 19:18:01 +00:00
|
|
|
return name_;
|
|
|
|
}
|
|
|
|
|
2006-12-21 13:58:28 +00:00
|
|
|
docstring const email() const {
|
2003-02-08 19:18:01 +00:00
|
|
|
return email_;
|
|
|
|
}
|
2003-03-04 09:27:27 +00:00
|
|
|
|
2007-07-09 20:52:34 +00:00
|
|
|
void used(bool u) const {
|
|
|
|
used_ = u;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool used() const {
|
|
|
|
return used_;
|
|
|
|
}
|
|
|
|
|
2006-12-21 13:58:28 +00:00
|
|
|
friend std::istream & operator>>(std::istream & os, Author & a);
|
2003-02-08 19:18:01 +00:00
|
|
|
|
|
|
|
private:
|
2006-12-21 13:58:28 +00:00
|
|
|
docstring name_;
|
2003-02-08 19:18:01 +00:00
|
|
|
|
2006-12-21 13:58:28 +00:00
|
|
|
docstring email_;
|
2007-07-09 20:52:34 +00:00
|
|
|
|
|
|
|
mutable bool used_;
|
2003-02-08 19:18:01 +00:00
|
|
|
};
|
2003-03-04 09:27:27 +00:00
|
|
|
|
2003-02-08 19:18:01 +00:00
|
|
|
|
|
|
|
class AuthorList {
|
|
|
|
public:
|
2003-03-12 23:25:59 +00:00
|
|
|
AuthorList();
|
|
|
|
|
2003-02-08 19:18:01 +00:00
|
|
|
int record(Author const & a);
|
|
|
|
|
|
|
|
void record(int id, Author const & a);
|
2003-03-04 09:27:27 +00:00
|
|
|
|
2007-03-04 09:37:32 +00:00
|
|
|
Author const & get(int id) const;
|
2003-02-08 19:18:01 +00:00
|
|
|
|
|
|
|
typedef std::map<int, Author> Authors;
|
2003-03-04 09:27:27 +00:00
|
|
|
|
2003-02-08 19:18:01 +00:00
|
|
|
Authors::const_iterator begin() const;
|
|
|
|
|
|
|
|
Authors::const_iterator end() const;
|
|
|
|
|
|
|
|
private:
|
2003-03-12 23:25:59 +00:00
|
|
|
int last_id_;
|
|
|
|
|
2003-02-08 19:18:01 +00:00
|
|
|
Authors authors_;
|
|
|
|
};
|
2003-03-04 09:27:27 +00:00
|
|
|
|
2003-02-08 19:18:01 +00:00
|
|
|
bool operator==(Author const & l, Author const & r);
|
2003-03-04 09:27:27 +00:00
|
|
|
|
|
|
|
std::ostream & operator<<(std::ostream & os, Author const & a);
|
|
|
|
|
|
|
|
std::istream & operator>>(std::istream & os, Author & a);
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
} // namespace lyx
|
|
|
|
|
2003-02-08 19:18:01 +00:00
|
|
|
#endif // AUTHOR_H
|