Doxygen
LatexCodeGenerator类 参考

#include <latexgen.h>

+ 类 LatexCodeGenerator 继承关系图:
+ LatexCodeGenerator 的协作图:

Public 成员函数

 LatexCodeGenerator (TextStream &t, const QCString &relPath, const QCString &sourceFile)
 
 LatexCodeGenerator (TextStream &t)
 
void setRelativePath (const QCString &path)
 
void setSourceFileName (const QCString &sourceFileName)
 
void codify (const QCString &text) override
 
void writeCodeLink (CodeSymbolType type, const QCString &ref, const QCString &file, const QCString &anchor, const QCString &name, const QCString &tooltip) override
 
void writeTooltip (const QCString &, const DocLinkInfo &, const QCString &, const QCString &, const SourceLinkInfo &, const SourceLinkInfo &) override
 
void writeLineNumber (const QCString &, const QCString &, const QCString &, int, bool) override
 
void startCodeLine (bool) override
 
void endCodeLine () override
 
void startFontClass (const QCString &) override
 
void endFontClass () override
 
void writeCodeAnchor (const QCString &) override
 
void setCurrentDoc (const Definition *, const QCString &, bool) override
 
void addWord (const QCString &, bool) override
 
void startCodeFragment (const QCString &style) override
 
void endCodeFragment (const QCString &style) override
 
void incUsedTableLevel ()
 
void decUsedTableLevel ()
 
int usedTableLevel () const
 
- Public 成员函数 继承自 CodeOutputInterface
virtual ~CodeOutputInterface ()
 
 CodeOutputInterface ()
 
 CodeOutputInterface (const CodeOutputInterface &)=delete
 
CodeOutputInterfaceoperator= (const CodeOutputInterface &)=delete
 
virtual int id () const
 Identifier for the output file 更多...
 

Private 成员函数

void _writeCodeLink (const QCString &className, const QCString &ref, const QCString &file, const QCString &anchor, const QCString &name, const QCString &tooltip)
 
void docify (const QCString &str)
 

Private 属性

bool m_streamSet = false
 
TextStreamm_t
 
QCString m_relPath
 
QCString m_sourceFileName
 
int m_col = 0
 
bool m_doxyCodeLineOpen = false
 
int m_usedTableLevel = 0
 

详细描述

在文件 latexgen.h28 行定义.

构造及析构函数说明

◆ LatexCodeGenerator() [1/2]

LatexCodeGenerator::LatexCodeGenerator ( TextStream t,
const QCString relPath,
const QCString sourceFile 
)

在文件 latexgen.cpp52 行定义.

53  : m_t(t), m_relPath(relPath), m_sourceFileName(sourceFileName)
54 {
55 }

◆ LatexCodeGenerator() [2/2]

LatexCodeGenerator::LatexCodeGenerator ( TextStream t)

在文件 latexgen.cpp57 行定义.

57  : m_t(t)
58 {
59 }

成员函数说明

◆ _writeCodeLink()

void LatexCodeGenerator::_writeCodeLink ( const QCString className,
const QCString ref,
const QCString file,
const QCString anchor,
const QCString name,
const QCString tooltip 
)
private

◆ addWord()

void LatexCodeGenerator::addWord ( const QCString ,
bool   
)
inlineoverridevirtual

实现了 CodeOutputInterface.

在文件 latexgen.h54 行定义.

54 {}

◆ codify()

void LatexCodeGenerator::codify ( const QCString s)
overridevirtual

Writes an code fragment to the output. This function should keep spaces visible, should break lines at a newline and should convert tabs to the right number of spaces.

实现了 CodeOutputInterface.

在文件 latexgen.cpp71 行定义.

72 {
73  if (!str.isEmpty())
74  {
75  const signed char *p=(const signed char*)str.data();
76  signed char c;
77  //char cs[5];
78  int spacesToNextTabStop;
79  int tabSize = Config_getInt(TAB_SIZE);
80  static THREAD_LOCAL signed char *result = NULL;
81  static THREAD_LOCAL int lresult = 0;
82  int i;
83  while ((c=*p))
84  {
85  switch(c)
86  {
87  case 0x0c: p++; // remove ^L
88  break;
89  case ' ': m_t <<" ";
90  m_col++;
91  p++;
92  break;
93  case '^': m_t <<"\\string^";
94  m_col++;
95  p++;
96  break;
97  case '\t': spacesToNextTabStop =
98  tabSize - (m_col%tabSize);
99  for (i = 0; i < spacesToNextTabStop; i++) m_t <<" ";
100  m_col+=spacesToNextTabStop;
101  p++;
102  break;
103  case '\n': m_t << '\n';
104  m_col=0;
105  p++;
106  break;
107  default:
108  i=0;
109 
110 #undef COPYCHAR
111 // helper macro to copy a single utf8 character, dealing with multibyte chars.
112 #define COPYCHAR() do { \
113  int bytes = getUTF8CharNumBytes(c); \
114  if (lresult < (i + bytes + 1)) \
115  { \
116  lresult += 512; \
117  result = (signed char *)realloc(result, lresult); \
118  } \
119  for (int j=0; j<bytes && *p; j++) \
120  { \
121  result[i++]=*p++; \
122  } \
123  m_col++; \
124  } while(0)
125 
126  // gather characters until we find whitespace or another special character
127  COPYCHAR();
128  while ((c=*p) &&
129  c!=0x0c && c!='\t' && c!='\n' && c!=' ' && c!='^'
130  )
131  {
132  COPYCHAR();
133  }
134  result[i]=0; // add terminator
135  filterLatexString(m_t,(const char *)result,
136  false, // insideTabbing
137  true, // insidePre
138  false, // insideItem
139  m_usedTableLevel>0, // insideTable
140  false // keepSpaces
141  );
142  break;
143  }
144  }
145  }
146 }

引用了 Config_getInt, COPYCHAR, QCString::data(), filterLatexString(), QCString::isEmpty(), m_col, m_t, m_usedTableLevel , 以及 THREAD_LOCAL.

被这些函数引用 LatexGenerator::codify(), endCodeLine(), writeCodeLink() , 以及 writeLineNumber().

◆ decUsedTableLevel()

void LatexCodeGenerator::decUsedTableLevel ( )
inline

◆ docify()

void LatexCodeGenerator::docify ( const QCString str)
private

◆ endCodeFragment()

void LatexCodeGenerator::endCodeFragment ( const QCString style)
overridevirtual

Ends a block of code

实现了 CodeOutputInterface.

在文件 latexgen.cpp252 行定义.

253 {
254  //endCodeLine checks is there is still an open code line, if so closes it.
255  endCodeLine();
256 
257  m_t << "\\end{" << style << "}\n";
258 }

引用了 endCodeLine() , 以及 m_t.

被这些函数引用 LatexGenerator::endCodeFragment() , 以及 LatexDocVisitor::visit().

◆ endCodeLine()

void LatexCodeGenerator::endCodeLine ( )
overridevirtual

Ends a line of code started with startCodeLine()

实现了 CodeOutputInterface.

在文件 latexgen.cpp227 行定义.

228 {
229  if (m_doxyCodeLineOpen)
230  {
231  m_t << "}";
233  }
234  codify("\n");
235 }

引用了 codify(), FALSE, m_doxyCodeLineOpen , 以及 m_t.

被这些函数引用 endCodeFragment() , 以及 LatexGenerator::endCodeLine().

◆ endFontClass()

void LatexCodeGenerator::endFontClass ( )
overridevirtual

Ends a block started with startFontClass()

实现了 CodeOutputInterface.

在文件 latexgen.cpp242 行定义.

243 {
244  m_t << "}";
245 }

引用了 m_t.

被这些函数引用 LatexGenerator::endFontClass().

◆ incUsedTableLevel()

void LatexCodeGenerator::incUsedTableLevel ( )
inline

◆ setCurrentDoc()

void LatexCodeGenerator::setCurrentDoc ( const Definition ,
const QCString ,
bool   
)
inlineoverridevirtual

实现了 CodeOutputInterface.

在文件 latexgen.h53 行定义.

53 {}

◆ setRelativePath()

void LatexCodeGenerator::setRelativePath ( const QCString path)

在文件 latexgen.cpp61 行定义.

62 {
63  m_relPath = path;
64 }

引用了 m_relPath.

被这些函数引用 LatexGenerator::startFile().

◆ setSourceFileName()

void LatexCodeGenerator::setSourceFileName ( const QCString sourceFileName)

在文件 latexgen.cpp66 行定义.

67 {
68  m_sourceFileName = name;
69 }

引用了 m_sourceFileName.

被这些函数引用 LatexGenerator::endFile() , 以及 LatexGenerator::startFile().

◆ startCodeFragment()

void LatexCodeGenerator::startCodeFragment ( const QCString style)
overridevirtual

Starts a source code fragment. The fragment will be fed to the code parser (see code.h) for syntax highlighting and cross-referencing. The fragment ends by a call to endCodeFragment()

参数
styleThe kind of code fragment.

实现了 CodeOutputInterface.

在文件 latexgen.cpp247 行定义.

248 {
249  m_t << "\n\\begin{" << style << "}{" << m_usedTableLevel << "}\n";
250 }

引用了 m_t , 以及 m_usedTableLevel.

被这些函数引用 LatexGenerator::startCodeFragment() , 以及 LatexDocVisitor::visit().

◆ startCodeLine()

void LatexCodeGenerator::startCodeLine ( bool  )
overridevirtual

实现了 CodeOutputInterface.

在文件 latexgen.cpp217 行定义.

218 {
219  m_col=0;
220  if (!m_doxyCodeLineOpen)
221  {
222  m_t << "\\DoxyCodeLine{";
224  }
225 }

引用了 m_col, m_doxyCodeLineOpen, m_t , 以及 TRUE.

被这些函数引用 LatexGenerator::startCodeLine().

◆ startFontClass()

void LatexCodeGenerator::startFontClass ( const QCString clsName)
overridevirtual

Starts a block with a certain meaning. Used for syntax highlighting, which elements of the same type are rendered using the same 'font class'.

参数
clsNameThe category name.

实现了 CodeOutputInterface.

在文件 latexgen.cpp237 行定义.

238 {
239  m_t << "\\textcolor{" << name << "}{";
240 }

引用了 m_t.

被这些函数引用 LatexGenerator::startFontClass().

◆ usedTableLevel()

int LatexCodeGenerator::usedTableLevel ( ) const
inline

在文件 latexgen.h61 行定义.

61 { return m_usedTableLevel; }

引用了 m_usedTableLevel.

被这些函数引用 LatexGenerator::docify() , 以及 LatexDocVisitor::filter().

◆ writeCodeAnchor()

void LatexCodeGenerator::writeCodeAnchor ( const QCString name)
inlineoverridevirtual

Write an anchor to a source listing.

参数
nameThe name of the anchor.

实现了 CodeOutputInterface.

在文件 latexgen.h52 行定义.

52 {}

被这些函数引用 LatexGenerator::writeCodeAnchor().

◆ writeCodeLink()

void LatexCodeGenerator::writeCodeLink ( CodeSymbolType  type,
const QCString ref,
const QCString file,
const QCString anchor,
const QCString name,
const QCString tooltip 
)
overridevirtual

Writes a link to an object in a code fragment.

参数
typeThe type of symbol, used for semantic syntax highlighting, may be Default is no info is available.
refIf this is non-zero, the object is to be found in an external documentation file.
fileThe file in which the object is located.
anchorThe anchor uniquely identifying the object within the file.
nameThe text to display as a placeholder for the link.
tooltipThe tooltip to display when the mouse is on the link.

实现了 CodeOutputInterface.

在文件 latexgen.cpp149 行定义.

153 {
154  bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
155  bool usePDFLatex = Config_getBool(USE_PDFLATEX);
156  uint l = name.length();
157  if (ref.isEmpty() && usePDFLatex && pdfHyperlinks)
158  {
159  m_t << "\\mbox{\\hyperlink{";
160  if (!f.isEmpty()) m_t << stripPath(f);
161  if (!f.isEmpty() && !anchor.isEmpty()) m_t << "_";
162  if (!anchor.isEmpty()) m_t << anchor;
163  m_t << "}{";
164  codify(name);
165  m_t << "}}";
166  }
167  else
168  {
169  codify(name);
170  }
171  m_col+=l;
172 }

引用了 codify(), Config_getBool, QCString::isEmpty(), QCString::length(), m_col, m_t , 以及 stripPath().

被这些函数引用 LatexGenerator::writeCodeLink() , 以及 writeLineNumber().

◆ writeLineNumber()

void LatexCodeGenerator::writeLineNumber ( const QCString ref,
const QCString file,
const QCString anchor,
int  lineNumber,
bool  writeLineAnchor 
)
overridevirtual

Writes the line number of a source listing

参数
refExternal reference (when imported from a tag file)
fileThe file part of the URL pointing to the docs.
anchorThe anchor part of the URL pointing to the docs.
lineNumberThe line number to write
writeLineAnchorIndicates if an anchor for the line number needs to be written

实现了 CodeOutputInterface.

在文件 latexgen.cpp174 行定义.

175 {
176  bool usePDFLatex = Config_getBool(USE_PDFLATEX);
177  bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
178  if (!m_doxyCodeLineOpen)
179  {
180  m_t << "\\DoxyCodeLine{";
182  }
183  if (Config_getBool(SOURCE_BROWSER))
184  {
185  QCString lineNumber;
186  lineNumber.sprintf("%05d",l);
187 
188  QCString lineAnchor;
189  if (!m_sourceFileName.isEmpty())
190  {
191  lineAnchor.sprintf("_l%05d",l);
192  lineAnchor.prepend(stripExtensionGeneral(m_sourceFileName, ".tex"));
193  }
194  bool showTarget = usePDFLatex && pdfHyperlinks && !lineAnchor.isEmpty() && writeLineAnchor;
195  if (showTarget)
196  {
197  m_t << "\\Hypertarget{" << stripPath(lineAnchor) << "}";
198  }
199  if (!fileName.isEmpty())
200  {
201  writeCodeLink(CodeSymbolType::Default,ref,fileName,anchor,lineNumber,QCString());
202  }
203  else
204  {
205  codify(lineNumber);
206  }
207  m_t << " ";
208  }
209  else
210  {
211  m_t << l << " ";
212  }
213  m_col=0;
214 }

引用了 codify(), Config_getBool, Default, QCString::isEmpty(), m_col, m_doxyCodeLineOpen, m_sourceFileName, m_t, QCString::prepend(), QCString::sprintf(), stripExtensionGeneral(), stripPath(), TRUE , 以及 writeCodeLink().

被这些函数引用 LatexGenerator::writeLineNumber().

◆ writeTooltip()

void LatexCodeGenerator::writeTooltip ( const QCString id,
const DocLinkInfo docInfo,
const QCString decl,
const QCString desc,
const SourceLinkInfo defInfo,
const SourceLinkInfo declInfo 
)
inlineoverridevirtual

Writes a tool tip definition

参数
idunique identifier for the tooltip
docInfoInfo about the symbol's documentation.
declfull declaration of the symbol (for functions)
descbrief description for the symbol
defInfoInfo about the symbol's definition in the source code
declInfoInfo about the symbol's declaration in the source code

实现了 CodeOutputInterface.

在文件 latexgen.h40 行定义.

46  {}

被这些函数引用 LatexGenerator::writeTooltip().

类成员变量说明

◆ m_col

int LatexCodeGenerator::m_col = 0
private

在文件 latexgen.h73 行定义.

被这些函数引用 codify(), startCodeLine(), writeCodeLink() , 以及 writeLineNumber().

◆ m_doxyCodeLineOpen

bool LatexCodeGenerator::m_doxyCodeLineOpen = false
private

在文件 latexgen.h74 行定义.

被这些函数引用 endCodeLine(), startCodeLine() , 以及 writeLineNumber().

◆ m_relPath

QCString LatexCodeGenerator::m_relPath
private

在文件 latexgen.h71 行定义.

被这些函数引用 setRelativePath().

◆ m_sourceFileName

QCString LatexCodeGenerator::m_sourceFileName
private

在文件 latexgen.h72 行定义.

被这些函数引用 setSourceFileName() , 以及 writeLineNumber().

◆ m_streamSet

bool LatexCodeGenerator::m_streamSet = false
private

在文件 latexgen.h69 行定义.

◆ m_t

TextStream& LatexCodeGenerator::m_t
private

◆ m_usedTableLevel

int LatexCodeGenerator::m_usedTableLevel = 0
private

在文件 latexgen.h75 行定义.

被这些函数引用 codify(), decUsedTableLevel(), incUsedTableLevel(), startCodeFragment() , 以及 usedTableLevel().


该类的文档由以下文件生成:
LatexCodeGenerator::m_doxyCodeLineOpen
bool m_doxyCodeLineOpen
Definition: latexgen.h:74
THREAD_LOCAL
#define THREAD_LOCAL
Definition: doxygen.h:27
stripExtensionGeneral
QCString stripExtensionGeneral(const QCString &fName, const QCString &ext)
Definition: util.cpp:5285
LatexCodeGenerator::m_col
int m_col
Definition: latexgen.h:73
LatexCodeGenerator::m_usedTableLevel
int m_usedTableLevel
Definition: latexgen.h:75
QCString::length
uint length() const
Returns the length of the string, not counting the 0-terminator.
Definition: qcstring.h:147
QCString::isEmpty
bool isEmpty() const
Returns TRUE iff the string is empty
Definition: qcstring.h:144
LatexCodeGenerator::endCodeLine
void endCodeLine() override
Definition: latexgen.cpp:227
uint
unsigned uint
Definition: qcstring.h:40
Config_getInt
#define Config_getInt(name)
Definition: config.h:34
stripPath
QCString stripPath(const QCString &s)
Definition: util.cpp:5318
TRUE
#define TRUE
Definition: qcstring.h:36
LatexCodeGenerator::m_sourceFileName
QCString m_sourceFileName
Definition: latexgen.h:72
LatexCodeGenerator::codify
void codify(const QCString &text) override
Definition: latexgen.cpp:71
Config_getBool
#define Config_getBool(name)
Definition: config.h:33
LatexCodeGenerator::writeCodeLink
void writeCodeLink(CodeSymbolType type, const QCString &ref, const QCString &file, const QCString &anchor, const QCString &name, const QCString &tooltip) override
Definition: latexgen.cpp:149
CodeSymbolType::Default
@ Default
COPYCHAR
#define COPYCHAR()
filterLatexString
void filterLatexString(TextStream &t, const QCString &str, bool insideTabbing, bool insidePre, bool insideItem, bool insideTable, bool keepSpaces)
Definition: util.cpp:4934
LatexCodeGenerator::m_t
TextStream & m_t
Definition: latexgen.h:70
QCString::prepend
QCString & prepend(const char *s)
Definition: qcstring.h:339
LatexCodeGenerator::m_relPath
QCString m_relPath
Definition: latexgen.h:71
QCString::sprintf
QCString & sprintf(const char *format,...)
Definition: qcstring.cpp:24
FALSE
#define FALSE
Definition: qcstring.h:33
QCString
This is an alternative implementation of QCString.
Definition: qcstring.h:108