Citation manager class.
更多...
#include <cite.h>
Citation manager class.
This class provides access do the database of bibliographic references through the bibtex backend.
在文件 cite.h 第 37 行定义.
◆ CitationManager()
CitationManager::CitationManager |
( |
| ) |
|
|
private |
Create the database, with an expected maximum of size entries
在文件 cite.cpp 第 62 行定义.
◆ anchorPrefix()
QCString CitationManager::anchorPrefix |
( |
| ) |
const |
◆ clear()
void CitationManager::clear |
( |
| ) |
|
◆ fileName()
QCString CitationManager::fileName |
( |
| ) |
const |
◆ find()
◆ generatePage()
void CitationManager::generatePage |
( |
| ) |
|
Generate the citations page
在文件 cite.cpp 第 192 行定义.
203 for (
const auto &bibdata : citeDataList)
206 if (!bibFile.
isEmpty() && bibFile.
right(4)!=
".bib") bibFile+=
".bib";
212 QCString citeListFile = outputDir+
"/citelist.doc";
214 std::ofstream t(citeListFile.
str(),std::ofstream::out | std::ofstream::binary);
217 err(
"could not open file %s for writing\n",
qPrint(citeListFile));
219 t <<
"<!-- BEGIN CITATIONS -->\n";
221 for (
const auto &it :
p->entries)
223 t <<
"\\citation{" << it.second->label() <<
"}\n";
226 t <<
"<!-- END CITATIONS -->\n";
227 t <<
"<!-- BEGIN BIBLIOGRAPHY -->\n";
228 t <<
"<!-- END BIBLIOGRAPHY -->\n";
233 QCString bib2xhtmlFile = outputDir+
"/bib2xhtml.pl";
237 QCString doxygenBstFile = outputDir+
"/doxygen.bst";
249 err(
"Failed to create temporary output directory '%s', skipping citations\n",
qPrint(bibOutputDir));
253 for (
const auto &bibdata : citeDataList)
256 if (!bibFile.
isEmpty() && bibFile.
right(4)!=
".bib") bibFile+=
".bib";
276 QCString perlArgs =
"\""+bib2xhtmlFile+
"\" "+bibOutputFiles+
" \""+ citeListFile+
"\"";
277 if (citeDebug) perlArgs+=
" -d";
280 err(
"Problems running bibtex. Verify that the command 'perl --version' works from the command line. Exit code: %d\n",
290 std::ifstream f(citeListFile.str(),std::ifstream::in);
293 err(
"could not open file %s for reading\n",
qPrint(citeListFile));
296 bool insideBib=
FALSE;
299 while (getline(f,lineStr))
304 if (line.find(
"<!-- BEGIN BIBLIOGRAPHY")!=-1) insideBib=
TRUE;
305 else if (line.find(
"<!-- END BIBLIOGRAPH")!=-1) insideBib=
FALSE;
307 if (insideBib && (i=line.find(
"name=\"CITEREF_"))!=-1)
309 int j=line.find(
"\">[");
310 int k=line.find(
"]</a>");
319 line = line.left(ui+14) + label + line.
right(line.length()-uj);
320 auto it =
p->entries.find(label.
str());
322 if (it!=
p->entries.end())
324 it->second->setText(number);
328 if (insideBib) doc+=line+
"\n";
343 for (
const auto &bibdata : citeDataList)
347 if (!bibFile.
isEmpty() && bibFile.
right(4)!=
".bib") bibFile+=
".bib";
361 err(
"bib file %s not found!\n",
qPrint(bibFile));
369 thisDir.
remove(citeListFile.str());
375 for (
size_t j = 1; j <= citeDataList.size(); j++)
引用了 addRelatedPage(), bibTmpDir, bibTmpFile, Debug::Cite, Config_getBool, Config_getList, Config_getString, copyFile(), ResourceMgr::copyResource(), Dir::currentDirPath(), err(), FileInfo::exists(), Dir::exists(), FALSE, fileName(), QCString::find(), insertCrossReferencesForBibFile(), ResourceMgr::instance(), isEmpty(), QCString::isEmpty(), Debug::isFlagSet(), QCString::left(), QCString::length(), QCString::mid(), Dir::mkdir(), p, qPrint(), Dir::remove(), QCString::right(), Dir::rmdir(), Dir::setCurrent(), QCString::setNum(), QCString::str(), substitute(), Portable::system(), Portable::sysTimerStop(), theTranslator, Translator::trCiteReferences() , 以及 TRUE.
被这些函数引用 parseInput().
◆ insert()
void CitationManager::insert |
( |
const QCString & |
label | ) |
|
◆ insertCrossReferencesForBibFile()
void CitationManager::insertCrossReferencesForBibFile |
( |
const QCString & |
bibFile | ) |
|
|
private |
在文件 cite.cpp 第 106 行定义.
116 err(
"bib file %s not found!\n",
qPrint(bibFile));
119 std::ifstream f(bibFile.
str(), std::ifstream::in);
122 err(
"could not open file %s for reading\n",
qPrint(bibFile));
130 while (getline(f,lineStr))
134 if (line.stripWhiteSpace().startsWith(
"@"))
137 int j = line.find(
'{');
139 while (j==-1 && getline(f,lineStr))
146 if (!f.eof() && j!=-1)
148 int k = line.
find(
',',j);
152 while (!f.eof() && citeName.
isEmpty())
160 citeName = line.
mid((
uint)(j));
164 if (citeName.
isEmpty() && getline(f,lineStr))
173 else if ((i=line.find(
"crossref"))!=-1 && !citeName.
isEmpty())
175 int j = line.find(
'{',i);
176 int k = line.find(
'}',i);
182 if ((
p->entries.find(citeName.
str())!=
p->entries.end()) &&
183 (
p->entries.find(crossrefName.
str())==
p->entries.end()))
引用了 err(), FileInfo::exists(), QCString::find(), insert(), QCString::isEmpty(), QCString::mid(), p, qPrint(), QCString::startsWith(), QCString::str() , 以及 QCString::stripWhiteSpace().
被这些函数引用 generatePage().
◆ instance()
◆ isEmpty()
bool CitationManager::isEmpty |
( |
| ) |
const |
◆ latexBibFiles()
QCString CitationManager::latexBibFiles |
( |
| ) |
|
std::unique_ptr<Private> CitationManager::p |
|
private |
该类的文档由以下文件生成:
std::vector< std::string > StringVector
bool copyResource(const QCString &name, const QCString &targetDir) const
Copies a registered resource to a given target directory
static std::string currentDirPath()
static ResourceMgr & instance()
Returns the one and only instance of this class
bool remove(const std::string &path, bool acceptsAbsPath=true) const
Class representing a directory in the file system
bool isEmpty() const
Returns TRUE iff the string is empty
static void addRelatedPage(Entry *root)
bool copyFile(const QCString &src, const QCString &dest)
Copies the contents of file with name src to the newly created file with name dest.
void err(const char *fmt,...)
int find(char c, int index=0, bool cs=TRUE) const
std::unique_ptr< Private > p
static bool isFlagSet(DebugMask mask)
QCString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
Translator * theTranslator
void insert(const QCString &label)
Insert a citation identified by label into the database
bool isEmpty() const
return TRUE if there are no citations.
int system(const QCString &command, const QCString &args, bool commandHasConsole=true)
static bool setCurrent(const std::string &path)
QCString & setNum(short n)
void insertCrossReferencesForBibFile(const QCString &bibFile)
QCString mid(size_t index, size_t len=static_cast< size_t >(-1)) const
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
virtual QCString trCiteReferences()=0
#define Config_getBool(name)
QCString fileName() const
Minimal replacement for QFileInfo.
const char * qPrint(const char *s)
#define Config_getString(name)
bool rmdir(const std::string &path, bool acceptsAbsPath=true) const
bool mkdir(const std::string &path, bool acceptsAbsPath=true) const
QCString right(size_t len) const
#define Config_getList(name)
This is an alternative implementation of QCString.