1
/***************************************************************************
2
* Copyright (C) 2004-2010 by Thomas Fischer *
3
* fischer@unix-ag.uni-kl.de *
5
* This program is free software; you can redistribute it and/or modify *
6
* it under the terms of the GNU General Public License as published by *
7
* the Free Software Foundation; either version 2 of the License, or *
8
* (at your option) any later version. *
10
* This program is distributed in the hope that it will be useful, *
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13
* GNU General Public License for more details. *
15
* You should have received a copy of the GNU General Public License *
16
* along with this program; if not, write to the *
17
* Free Software Foundation, Inc., *
18
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19
***************************************************************************/
20
#ifndef BIBTEXBIBTEXENTRY_H
21
#define BIBTEXBIBTEXENTRY_H
31
* This class represents an entry in a BibTeX file such as an article
32
* or a book. This class is essentially a map from keys such as title,
33
* year or other bibliography data to corresponding values.
35
* @author Thomas Fischer <fischer@unix-ag.uni-kl.de>
37
class KBIBTEXIO_EXPORT Entry : public Element, public QMap<QString, Value>
39
Q_PROPERTY(QString id READ id WRITE setId)
40
Q_PROPERTY(QString type READ type WRITE setType)
43
/** Representation of the BibTeX field key "abstract" */
44
static const QLatin1String ftAbstract;
45
/** Representation of the BibTeX field key "address" */
46
static const QLatin1String ftAddress;
47
/** Representation of the BibTeX field key "author" */
48
static const QLatin1String ftAuthor;
49
/** Representation of the BibTeX field key "booktitle" */
50
static const QLatin1String ftBookTitle;
51
/** Representation of the BibTeX field key "chapter" */
52
static const QLatin1String ftChapter;
53
/** Representation of the BibTeX field key "x-color" */
54
static const QLatin1String ftColor;
55
/** Representation of the BibTeX field key "comment" */
56
static const QLatin1String ftComment;
57
/** Representation of the BibTeX field key "crossref" */
58
static const QLatin1String ftCrossRef;
59
/** Representation of the BibTeX field key "doi" */
60
static const QLatin1String ftDOI;
61
/** Representation of the BibTeX field key "editor" */
62
static const QLatin1String ftEditor;
63
/** Representation of the BibTeX field key "issn" */
64
static const QLatin1String ftISSN;
65
/** Representation of the BibTeX field key "isbn" */
66
static const QLatin1String ftISBN;
67
/** Representation of the BibTeX field key "journal" */
68
static const QLatin1String ftJournal;
69
/** Representation of the BibTeX field key "keywords" */
70
static const QLatin1String ftKeywords;
71
/** Representation of the BibTeX field key "localfile" */
72
static const QLatin1String ftLocalFile;
73
/** Representation of the BibTeX field key "location" */
74
static const QLatin1String ftLocation;
75
/** Representation of the BibTeX field key "month" */
76
static const QLatin1String ftMonth;
77
/** Representation of the BibTeX field key "note" */
78
static const QLatin1String ftNote;
79
/** Representation of the BibTeX field key "number" */
80
static const QLatin1String ftNumber;
81
/** Representation of the BibTeX field key "pages" */
82
static const QLatin1String ftPages;
83
/** Representation of the BibTeX field key "publisher" */
84
static const QLatin1String ftPublisher;
85
/** Representation of the BibTeX field key "school" */
86
static const QLatin1String ftSchool;
87
/** Representation of the BibTeX field key "series" */
88
static const QLatin1String ftSeries;
89
/** Representation of the BibTeX field key "title" */
90
static const QLatin1String ftTitle;
91
/** Representation of the BibTeX field key "url" */
92
static const QLatin1String ftUrl;
93
/** Representation of the BibTeX field key "volume" */
94
static const QLatin1String ftVolume;
95
/** Representation of the BibTeX field key "year" */
96
static const QLatin1String ftYear;
98
/** Representation of the BibTeX entry type "Article" */
99
static const QLatin1String etArticle;
100
/** Representation of the BibTeX entry type "Book" */
101
static const QLatin1String etBook;
102
/** Representation of the BibTeX entry type "InBook" */
103
static const QLatin1String etInBook;
104
/** Representation of the BibTeX entry type "InProceedings" */
105
static const QLatin1String etInProceedings;
106
/** Representation of the BibTeX entry type "Misc" */
107
static const QLatin1String etMisc;
108
/** Representation of the BibTeX entry type "TechReport" */
109
static const QLatin1String etTechReport;
110
/** Representation of the BibTeX entry type "PhDThesis" */
111
static const QLatin1String etPhDThesis;
112
/** Representation of the BibTeX entry type "Unpublished" */
113
static const QLatin1String etUnpublished;
116
* Create a new entry type. Both type and id are optionally,
117
* allowing to call the constructor as Entry() only.
118
* Both type and id can be set and retrieved later.
119
* @param type type of this entry
121
Entry(const QString& type = QString::null, const QString &id = QString::null);
124
* Copy constructor cloning another entry object.
125
* @param other entry object to clone
127
Entry(const Entry &other);
132
* Assignment operator, working similar to a copy constructor,
133
* but overwrites the current object's values.
135
Entry& operator= (const Entry& other);
137
Value& operator[](const QString& key);
138
const Value operator[](const QString& key) const;
141
* Set the type of this entry. Common values are "article" or "book".
142
* @param type type of this entry
144
void setType(const QString& type);
147
* Retrieve the type of this entry. Common values are "article" or "book".
148
* @return type of this entry
150
QString type() const;
153
* Set the id of this entry. In LaTeX, this id is used to refer to a BibTeX
154
* entry using the "ref" command.
155
* @param id id of this entry
157
void setId(const QString& id);
160
* Retrieve the id of this entry. In LaTeX, this id is used to refer to a BibTeX
161
* entry using the "ref" command.
162
* @return id of this entry
167
* Re-implementation of QMap's value function, but performing a case-insensitive
168
* match on the key. E.g. querying for key "title" will find a key-value pair with
170
* @see #contains(const QString&)
171
* @param key field name to search for
172
* @return found value or Value() if nothing found
174
const Value value(const QString& key) const;
176
int remove(const QString& key);
179
* Re-implementation of QMap's contains function, but performing a case-insensitive
180
* match on the key. E.g. querying for key "title" will find a key-value pair with
182
* @see #value(const QString&)
183
* @param key field name to search for
184
* @return true if value with key found, else false
186
bool contains(const QString& key) const;
188
static Entry* resolveCrossref(const Entry &original, const File *bibTeXfile);
192
EntryPrivate * const d;
195
#endif // BIBTEXBIBTEXENTRY_H