Doxygen
definition.h 文件参考
#include <vector>
#include "types.h"
#include "reflist.h"
+ definition.h 的引用(Include)关系图:
+ 此图展示该文件直接或间接的被哪些文件引用了:

浏览源代码.

struct  DocInfo
 Data associated with a detailed description. 更多...
 
struct  BriefInfo
 Data associated with a brief description. 更多...
 
struct  BodyInfo
 Data associated with description found in the body. 更多...
 
class  Definition
 The common base class of all entity definitions found in the sources. 更多...
 
struct  Definition::Cookie
 
class  DefinitionMutable
 

函数

DefinitiontoDefinition (DefinitionMutable *dm)
 
DefinitionMutabletoDefinitionMutable (Definition *d)
 
DefinitionMutabletoDefinitionMutable (const Definition *d)
 
bool readCodeFragment (const QCString &fileName, int &startLine, int &endLine, QCString &result)
 Reads a fragment from file fileName starting with line startLine and ending with line endLine. 更多...
 

函数说明

◆ readCodeFragment()

bool readCodeFragment ( const QCString fileName,
int &  startLine,
int &  endLine,
QCString result 
)

Reads a fragment from file fileName starting with line startLine and ending with line endLine.

The result is returned as a string via result. The function returns TRUE if successful and FALSE in case of an error.

Reads a fragment of code from file fileName starting at line startLine and ending at line endLine (inclusive). The fragment is stored in result. If FALSE is returned the code fragment could not be found.

The file is scanned for a opening bracket ('{') from startLine onward The line actually containing the bracket is returned via startLine. The file is scanned for a closing bracket ('}') from endLine backward. The line actually containing the bracket is returned via endLine. Note that for VHDL code the bracket search is not done.

在文件 definition.cpp719 行定义.

721 {
722  //printf("readCodeFragment(%s,startLine=%d,endLine=%d)\n",fileName,startLine,endLine);
723  static bool filterSourceFiles = Config_getBool(FILTER_SOURCE_FILES);
724  QCString filter = getFileFilter(fileName,TRUE);
725  bool usePipe = !filter.isEmpty() && filterSourceFiles;
726  int tabSize = Config_getInt(TAB_SIZE);
727  SrcLangExt lang = getLanguageFromFileName(fileName);
728  const int blockSize = 4096;
729  BufStr str(blockSize);
730  g_filterCache.getFileContents(fileName,str);
731 
732  bool found = lang==SrcLangExt_VHDL ||
733  lang==SrcLangExt_Python ||
734  lang==SrcLangExt_Fortran;
735  // for VHDL, Python, and Fortran no bracket search is possible
736  char *p=str.data();
737  if (p)
738  {
739  char c=0;
740  int col=0;
741  int lineNr=1;
742  // skip until the startLine has reached
743  while (lineNr<startLine && *p)
744  {
745  while ((c=*p++)!='\n' && c!=0) /* skip */;
746  lineNr++;
747  if (found && c == '\n') c = '\0';
748  }
749  if (*p)
750  {
751  // skip until the opening bracket or lonely : is found
752  char cn=0;
753  while (lineNr<=endLine && *p && !found)
754  {
755  int pc=0;
756  while ((c=*p++)!='{' && c!=':' && c!=0)
757  {
758  //printf("parsing char '%c'\n",c);
759  if (c=='\n')
760  {
761  lineNr++,col=0;
762  }
763  else if (c=='\t')
764  {
765  col+=tabSize - (col%tabSize);
766  }
767  else if (pc=='/' && c=='/') // skip single line comment
768  {
769  while ((c=*p++)!='\n' && c!=0) pc=c;
770  if (c=='\n') lineNr++,col=0;
771  }
772  else if (pc=='/' && c=='*') // skip C style comment
773  {
774  while (((c=*p++)!='/' || pc!='*') && c!=0)
775  {
776  if (c=='\n') lineNr++,col=0;
777  pc=c;
778  }
779  }
780  else
781  {
782  col++;
783  }
784  pc = c;
785  }
786  if (c==':')
787  {
788  cn=*p++;
789  if (cn!=':') found=TRUE;
790  }
791  else if (c=='{')
792  {
793  found=TRUE;
794  }
795  }
796  //printf(" -> readCodeFragment(%s,%d,%d) lineNr=%d\n",fileName,startLine,endLine,lineNr);
797  if (found)
798  {
799  // For code with more than one line,
800  // fill the line with spaces until we are at the right column
801  // so that the opening brace lines up with the closing brace
802  if (endLine!=startLine)
803  {
804  QCString spaces;
805  spaces.fill(' ',col);
806  result+=spaces;
807  }
808  // copy until end of line
809  if (c) result+=c;
810  startLine=lineNr;
811  if (c==':')
812  {
813  result+=cn;
814  if (cn=='\n') lineNr++;
815  }
816  char lineStr[blockSize];
817  do
818  {
819  //printf("reading line %d in range %d-%d\n",lineNr,startLine,endLine);
820  int size_read;
821  do
822  {
823  // read up to maxLineLength-1 bytes, the last byte being zero
824  int i=0;
825  while ((c=*p++) && i<blockSize-1)
826  {
827  lineStr[i++]=c;
828  if (c=='\n') break; // stop at end of the line
829  }
830  lineStr[i]=0;
831  size_read=i;
832  result+=lineStr; // append line to the output
833  } while (size_read == (blockSize-1)); // append more if line does not fit in buffer
834  lineNr++;
835  } while (lineNr<=endLine && *p);
836 
837  // strip stuff after closing bracket
838  int newLineIndex = result.findRev('\n');
839  int braceIndex = result.findRev('}');
840  if (braceIndex > newLineIndex)
841  {
842  result.truncate((uint)braceIndex+1);
843  }
844  endLine=lineNr-1;
845  }
846  }
847  if (usePipe)
848  {
849  Debug::print(Debug::FilterOutput, 0, "Filter output\n");
850  Debug::print(Debug::FilterOutput,0,"-------------\n%s\n-------------\n",qPrint(result));
851  }
852  }
853  result = transcodeCharacterStringToUTF8(result);
854  if (!result.isEmpty() && result.at(result.length()-1)!='\n') result += "\n";
855  //printf("readCodeFragment(%d-%d)=%s\n",startLine,endLine,qPrint(result));
856  return found;
857 }

引用了 QCString::at(), Config_getBool, Config_getInt, BufStr::data(), QCString::fill(), Debug::FilterOutput, QCString::findRev(), g_filterCache, FilterCache::getFileContents(), getFileFilter(), getLanguageFromFileName(), QCString::isEmpty(), QCString::length(), Debug::print(), qPrint(), SrcLangExt_Fortran, SrcLangExt_Python, SrcLangExt_VHDL, transcodeCharacterStringToUTF8(), TRUE , 以及 QCString::truncate().

被这些函数引用 VhdlDocGen::createFlowChart(), MemberContext::Private::createSourceCode() , 以及 DefinitionImpl::writeInlineCode().

◆ toDefinition()

Definition* toDefinition ( DefinitionMutable dm)

◆ toDefinitionMutable() [1/2]

DefinitionMutable* toDefinitionMutable ( const Definition d)

在文件 definition.cpp1962 行定义.

1963 {
1964  return toDefinitionMutable(const_cast<Definition*>(d));
1965 }

引用了 toDefinitionMutable().

◆ toDefinitionMutable() [2/2]

DefinitionMutable* toDefinitionMutable ( Definition d)
Definition
The common base class of all entity definitions found in the sources.
Definition: definition.h:76
BufStr
Buffer used to store strings
Definition: bufstr.h:29
QCString::length
uint length() const
Returns the length of the string, not counting the 0-terminator.
Definition: qcstring.h:147
QCString::findRev
int findRev(char c, int index=-1, bool cs=TRUE) const
Definition: qcstring.cpp:86
QCString::isEmpty
bool isEmpty() const
Returns TRUE iff the string is empty
Definition: qcstring.h:144
transcodeCharacterStringToUTF8
QCString transcodeCharacterStringToUTF8(const QCString &input)
Definition: util.cpp:1350
SrcLangExt
SrcLangExt
Language as given by extension
Definition: types.h:41
QCString::at
char & at(size_t i)
Returns a reference to the character at index i.
Definition: qcstring.h:477
g_filterCache
static FilterCache g_filterCache
Definition: definition.cpp:703
uint
unsigned uint
Definition: qcstring.h:40
toDefinitionMutable
DefinitionMutable * toDefinitionMutable(Definition *d)
Definition: definition.cpp:1956
Config_getInt
#define Config_getInt(name)
Definition: config.h:34
Debug::print
static void print(DebugMask mask, int prio, const char *fmt,...)
Definition: debug.cpp:57
SrcLangExt_Python
@ SrcLangExt_Python
Definition: types.h:52
Debug::FilterOutput
@ FilterOutput
Definition: debug.h:38
getLanguageFromFileName
SrcLangExt getLanguageFromFileName(const QCString &fileName, SrcLangExt defLang)
Definition: util.cpp:5574
TRUE
#define TRUE
Definition: qcstring.h:36
SrcLangExt_Fortran
@ SrcLangExt_Fortran
Definition: types.h:53
QCString::fill
bool fill(char c, int len=-1)
Fills a string with a predefined character
Definition: qcstring.h:175
QCString::truncate
bool truncate(size_t pos)
Truncates the string at position pos.
Definition: qcstring.h:167
Config_getBool
#define Config_getBool(name)
Definition: config.h:33
qPrint
const char * qPrint(const char *s)
Definition: qcstring.h:589
FilterCache::getFileContents
bool getFileContents(const QCString &fileName, BufStr &str)
Definition: definition.cpp:589
DefinitionMutable::toDefinition_
virtual Definition * toDefinition_()=0
SrcLangExt_VHDL
@ SrcLangExt_VHDL
Definition: types.h:54
Definition::toDefinitionMutable_
virtual DefinitionMutable * toDefinitionMutable_()=0
getFileFilter
QCString getFileFilter(const QCString &name, bool isSourceCode)
Definition: util.cpp:1315
QCString
This is an alternative implementation of QCString.
Definition: qcstring.h:108