Fix for UBSan build
[platform/upstream/doxygen.git] / src / cite.h
1 /******************************************************************************
2  *
3  * 
4  *
5  * Copyright (C) 2011 by Dimitri van Heesch
6  * Based on a patch by David Munger
7  *
8  * Permission to use, copy, modify, and distribute this software and its
9  * documentation under the terms of the GNU General Public License is hereby 
10  * granted. No representations are made about the suitability of this software 
11  * for any purpose. It is provided "as is" without express or implied warranty.
12  * See the GNU General Public License for more details.
13  *
14  * Documents produced by Doxygen are derivative works derived from the
15  * input used in their production; they are not affected by this license.
16  *
17  */
18
19 #ifndef CITEDB_H
20 #define CITEDB_H
21
22 #include "qtbc.h"
23 #include <qdict.h>
24 #include <qlist.h>
25
26 class FTextStream;
27
28 /// String constants for citations
29 struct CiteConsts
30 {
31   static const QCString fileName;
32   static const QCString anchorPrefix;
33 };
34
35 /// Citation-related data.
36 struct CiteInfo
37 {
38   CiteInfo(const char *label_, const char *text_=0, const char *fullText_=0,
39       const char *ref_=0) :
40     label(label_), text(text_), fullText(fullText_), ref(ref_)
41   { }
42
43   CiteInfo(const CiteInfo &o)
44   { label=o.label.copy(); text=o.text.copy(); fullText=o.fullText.copy(); ref=o.ref.copy(); }
45
46   QCString label; 
47   QCString text;
48   QCString fullText;
49   QCString ref;
50
51 };
52
53 /**
54  * @brief Cite database access class.
55  * @details This class provides access do the database of bibliographic 
56  * references through the bibtex backend.
57  */
58 class CiteDict 
59 {
60   public:
61     /** Create the database, with an expected maximum of \a size entries */
62     CiteDict(int size);
63
64 //    /** Resolve references to citations */
65 //    void resolve();
66
67     /** Insert a citation identified by \a label into the database */
68     void insert(const char *label);
69
70     /** Return the citation info for a given \a label */
71     CiteInfo *find(const char *label) const;
72
73     /** Generate the citations page */
74     void generatePage() const;
75
76     /** clears the database */
77     void clear();
78
79     /** return TRUE if there are no citations. 
80      *  Only valid after calling resolve() 
81      */
82     bool isEmpty() const;
83
84     /** writes the latex code for the standard bibliography 
85      *  section to text stream \a t 
86      */
87     void writeLatexBibliography(FTextStream &t);
88
89   private:
90 //    bool writeAux();
91 //    bool writeBst();
92 //    bool execute();
93 //    void parse();
94 //    void clean();
95     QDict<CiteInfo> m_entries;
96 //    QList<QCString> m_ordering;
97     QCString m_baseFileName;
98 };
99
100 #endif