"Fossies" - the Fresh Open Source Software Archive 
Member "cb2bib-2.0.1/src/c2b/bibParser.h" (12 Feb 2021, 4076 Bytes) of package /linux/privat/cb2bib-2.0.1.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
For more information about "bibParser.h" see the
Fossies "Dox" file reference documentation and the latest
Fossies "Diffs" side-by-side code changes report:
2.0.0_vs_2.0.1.
1 /***************************************************************************
2 * Copyright (C) 2004-2021 by Pere Constans
3 * constans@molspaces.com
4 * cb2Bib version 2.0.1. Licensed under the GNU GPL version 3.
5 * See the LICENSE file that comes with this distribution.
6 ***************************************************************************/
7 #ifndef BIBPARSER_H
8 #define BIBPARSER_H
9
10 #include "cb2bib_parameters.h"
11 #include "coreBibParser.h"
12 #include "journalDB.h"
13 #include "monthDB.h"
14
15
16 class bibPreparser;
17 class heuristicBibParser;
18 class idMaker;
19 class preprocess;
20
21
22 /**
23 Class for bibliographic reference parsing and manipulation
24
25 @author Pere Constans
26 */
27 class bibParser : public coreBibParser
28 {
29
30 Q_OBJECT
31
32 public:
33 explicit bibParser(QObject* parento = 0);
34 virtual ~bibParser();
35
36 QString documentFilename(const QString& base_fn, const QString& bibtex_fn);
37 QString excerpt(const QString& text, const QStringList& hints) const;
38 QString parse(const QString& field, const QString& value, const QString& init_value = QString());
39 QString setJournalsToAbbreviated(const QString& text, const bool alternate);
40 QString setJournalsToFull(const QString& text, const bool alternate);
41 QString setTags(const QString& text) const;
42 bibReference& parse(bibReference& reference);
43 virtual void setCiteID();
44 virtual void setField(const QString& name, const QString& value);
45 virtual void setReferenceType(const QString& type);
46 void guessFields(const QString& text);
47 void parse(const QString& text, QString* out_text, QString* out_tagtext);
48 void preparse(const QString& text, QString* out_text);
49
50 inline QString abbreviatedJournal(const QString& name) const
51 {
52 return _journal_dbP->retrieve(name);
53 }
54 inline QString fullJournal(const QString& name) const
55 {
56 return _journal_dbP->retrieveFull(name);
57 }
58 inline QString alternateAbbreviatedJournal(const QString& name) const
59 {
60 return _journal_dbP->retrieveAlternate(name);
61 }
62 inline QString alternateFullJournal(const QString& name) const
63 {
64 return _journal_dbP->retrieveAlternateFull(name);
65 }
66 inline const QStringList& abbreviatedJournalList() const
67 {
68 return _journal_dbP->abbreviatedList();
69 }
70 inline bool isAutoRecognized() const
71 {
72 return _auto_recognized;
73 }
74 inline QString autoRecognizedString() const
75 {
76 return _auto_recognized_string;
77 }
78 inline QString toBibTeX(bool sig = true) const
79 {
80 if (sig)
81 return "% cb2Bib " + C2B_VERSION + '\n' + referenceToFomattedBibTeX(_current_reference) + '\n';
82 else
83 return referenceToFomattedBibTeX(_current_reference);
84 }
85 inline QString toBibTeX(const bibReference& ref, bool sig = true) const
86 {
87 if (sig)
88 return "% cb2Bib " + C2B_VERSION + '\n' + referenceToFomattedBibTeX(ref) + '\n';
89 else
90 return referenceToFomattedBibTeX(ref);
91 }
92 inline const bibReference& currentReference() const
93 {
94 return _current_reference;
95 }
96 inline void clearCurrentReference()
97 {
98 _current_reference.clearReference();
99 _auto_recognized = false;
100 _auto_recognized_string.clear();
101 }
102 inline int fieldCount() const
103 {
104 return coreBibParser::fieldCount(_current_reference);
105 }
106
107
108 signals:
109 void statusMessage(const QString& ms);
110
111
112 protected:
113 bibPreparser* _preparserP;
114 bibReference _current_reference;
115 idMaker* _cite_idmP;
116 idMaker* _file_idmP;
117 inline virtual void currentReferenceUpdated() {}
118 virtual void checkRegExpFile(const QString& fn);
119
120
121 private:
122 QString _auto_recognized_string;
123 QString metadataSection(const QString& text, const QString& identifier) const;
124 QString removeTags(const QString& text) const;
125 bool _auto_recognized;
126 heuristicBibParser* _heuristic_parserP;
127 journalDB* _journal_dbP;
128 monthDB* _month_dbP;
129 preprocess* _preprocessP;
130
131
132 friend class heuristicBibParser;
133 };
134
135 #endif