The codefragment.cpp
File Reference
Included Headers
#include <mutex>
#include <unordered_map>
#include <map>
#include "codefragment.h"
#include "util.h"
#include "doxygen.h"
#include "parserintf.h"
#include "outputlist.h"
#include "clangparser.h"
#include "trace.h"
#include "fileinfo.h"
#include "filedef.h"
#include "portable.h"
#include "message.h"
Classes Index
struct | Private |
struct | BlockMarker |
struct | FragmentInfo |
Functions Index
static QCString | readTextFileByName (const QCString &file) |
Functions
readTextFileByName()
| static |
Definition at line 195 of file codefragment.cpp.
195static QCString readTextFileByName(const QCString &file)
196{
197 AUTO_TRACE("file={}",file);
198 if (Portable::isAbsolutePath(file))
199 {
201 if (fi.exists())
202 {
203 return fileToString(file,Config_getBool(FILTER_SOURCE_FILES));
204 }
205 }
206 const StringVector &examplePathList = Config_getList(EXAMPLE_PATH);
207 for (const auto &s : examplePathList)
208 {
209 std::string absFileName = s+(Portable::pathSeparator()+file).str();
210 FileInfo fi(absFileName);
211 if (fi.exists())
212 {
213 return fileToString(QCString(absFileName),Config_getBool(FILTER_SOURCE_FILES));
214 }
215 }
216
217 // as a fallback we also look in the exampleNameDict
218 bool ambig=false;
219 FileDef *fd = findFileDef(Doxygen::exampleNameLinkedMap,file,ambig);
220 if (fd)
221 {
222 if (ambig)
223 {
224 err("included file name '{}' is ambiguous.\nPossible candidates:\n{}\n",file,
226 );
227 }
228 return fileToString(fd->absFilePath(),Config_getBool(FILTER_SOURCE_FILES));
229 }
230 else
231 {
232 err("included file {} is not found. Check your EXAMPLE_PATH\n",file);
233 }
234 return QCString();
235}
References FileDef::absFilePath, AUTO_TRACE, Config_getBool, Config_getList, err, Doxygen::exampleNameLinkedMap, FileInfo::exists, fileToString, findFileDef, Portable::isAbsolutePath, Portable::pathSeparator, showFileDefMatches and QCString::str.
Referenced by CodeFragmentManager::parseCodeFragment.
Generated via doxygen2docusaurus by Doxygen 1.14.0.