浏览该文件的文档.
53 std::map< std::string,std::unique_ptr<CiteInfoImpl> >
entries;
71 std::make_unique<CiteInfoImpl>(label)
77 auto it =
p->entries.find(label.
str());
78 if (it!=
p->entries.end())
80 return it->second.get();
93 return (numFiles==0 ||
p->entries.empty());
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))
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()))
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>");
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++)
389 for (
const auto &bibdata : citeDataList)
393 if (!bibFile.
isEmpty() && bibFile.
right(4)!=
".bib") bibFile+=
".bib";
399 if (i) result +=
",";
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
CiteInfoImpl(const QCString &label, const QCString &text=QCString())
const CiteInfo * find(const QCString &label) const
Return the citation info for a given label.
bool remove(const std::string &path, bool acceptsAbsPath=true) const
Class representing a directory in the file system
void clear()
clears the database
uint length() const
Returns the length of the string, not counting the 0-terminator.
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
static CitationManager & instance()
virtual QCString label() const
QCString latexBibFiles()
lists the bibtex cite files in a comma separated list
std::unique_ptr< Private > p
static bool isFlagSet(DebugMask mask)
CitationManager()
Create the database, with an expected maximum of size entries
QCString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
virtual QCString text() const
QCString left(size_t len) const
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.
void generatePage()
Generate the citations page
int system(const QCString &command, const QCString &args, bool commandHasConsole=true)
static bool setCurrent(const std::string &path)
void setText(const QCString &s)
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
std::map< std::string, std::unique_ptr< CiteInfoImpl > > entries
virtual QCString trCiteReferences()=0
#define Config_getBool(name)
QCString fileName() const
bool startsWith(const char *s) 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
Portable versions of functions that are platform dependent.
bool mkdir(const std::string &path, bool acceptsAbsPath=true) const
A bunch of utility functions.
QCString right(size_t len) const
QCString anchorPrefix() const
#define Config_getList(name)
This is an alternative implementation of QCString.