summaryrefslogtreecommitdiffstats
path: root/src/cite.h
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2020-02-16 15:36:19 (GMT)
committerDimitri van Heesch <doxygen@gmail.com>2020-02-16 15:36:19 (GMT)
commitfa520f975a0893c0d123c1cafec63206bf737794 (patch)
tree024181ca310a331d81a0aaed62084f5ebf3c4a77 /src/cite.h
parent80bcbbb8702634d0078a37e44a1ab263b8f8336f (diff)
downloadDoxygen-fa520f975a0893c0d123c1cafec63206bf737794.zip
Doxygen-fa520f975a0893c0d123c1cafec63206bf737794.tar.gz
Doxygen-fa520f975a0893c0d123c1cafec63206bf737794.tar.bz2
Restructure citation handling
Diffstat (limited to 'src/cite.h')
-rw-r--r--src/cite.h81
1 files changed, 30 insertions, 51 deletions
diff --git a/src/cite.h b/src/cite.h
index 1c59553..4666d5a 100644
--- a/src/cite.h
+++ b/src/cite.h
@@ -1,8 +1,6 @@
/******************************************************************************
*
- *
- *
- * Copyright (C) 2011 by Dimitri van Heesch
+ * Copyright (C) 2020 by Dimitri van Heesch
* Based on a patch by David Munger
*
* Permission to use, copy, modify, and distribute this software and its
@@ -16,83 +14,64 @@
*
*/
-#ifndef CITEDB_H
-#define CITEDB_H
+#ifndef CITE_H
+#define CITE_H
-#include <qdict.h>
+#include <memory>
-class FTextStream;
+#include <qcstring.h>
-/// String constants for citations
-struct CiteConsts
-{
- static const QCString fileName;
- static const QCString anchorPrefix;
-};
+class FTextStream;
/// Citation-related data.
struct CiteInfo
{
- CiteInfo(const char *label_, const char *text_=0, const char *fullText_=0,
- const char *ref_=0) :
- label(label_), text(text_), fullText(fullText_), ref(ref_)
- { }
-
- CiteInfo(const CiteInfo &o)
- { label=o.label.copy(); text=o.text.copy(); fullText=o.fullText.copy(); ref=o.ref.copy(); }
-
- QCString label;
- QCString text;
- QCString fullText;
- QCString ref;
-
+ virtual ~CiteInfo() {}
+ virtual QCString label() const = 0;
+ virtual QCString text() const = 0;
};
/**
- * @brief Cite database access class.
- * @details This class provides access do the database of bibliographic
+ * @brief Citation manager class.
+ * @details This class provides access do the database of bibliographic
* references through the bibtex backend.
*/
-class CiteDict
+class CitationManager
{
public:
- /** Create the database, with an expected maximum of \a size entries */
- CiteDict(int size);
-
-// /** Resolve references to citations */
-// void resolve();
+ static CitationManager &instance();
/** Insert a citation identified by \a label into the database */
void insert(const char *label);
- /** Return the citation info for a given \a label */
- CiteInfo *find(const char *label) const;
+ /** Return the citation info for a given \a label.
+ * Ownership of the info stays with the manager.
+ */
+ const CiteInfo *find(const char *label) const;
/** Generate the citations page */
- void generatePage() const;
+ void generatePage();
/** clears the database */
void clear();
- /** return TRUE if there are no citations.
- * Only valid after calling resolve()
+ /** return TRUE if there are no citations.
*/
bool isEmpty() const;
- /** writes the latex code for the standard bibliography
- * section to text stream \a t
+ /** writes the latex code for the standard bibliography
+ * section to text stream \a t
*/
- void writeLatexBibliography(FTextStream &t);
+ void writeLatexBibliography(FTextStream &t) const;
+
+ const char *fileName() const;
+ const char *anchorPrefix() const;
private:
-// bool writeAux();
-// bool writeBst();
-// bool execute();
-// void parse();
-// void clean();
- QDict<CiteInfo> m_entries;
-// QList<QCString> m_ordering;
- QCString m_baseFileName;
+ /** Create the database, with an expected maximum of \a size entries */
+ CitationManager();
+ struct Private;
+ std::unique_ptr<Private> p;
};
-#endif
+#endif // CITE_H