Doxygen
rtfstyle.cpp 文件参考
#include <string>
#include <fstream>
#include "rtfstyle.h"
#include "message.h"
#include "regex.h"
+ rtfstyle.cpp 的引用(Include)关系图:

浏览源代码.

宏定义

#define RTF_LatexToc(lvl, nest, nxt, pos, twps)
 
#define RTF_ListBullet(lvl, nest, nxt, pos, lvl2)
 
#define RTF_ListEnum(lvl, nest, nxt, pos)
 
#define RTF_CodeExample(lvl, nest, nxt, pos)
 
#define RTF_ListContinue(lvl, nest, nxt, pos)
 
#define RTF_DescContinue(lvl, nest, nxt, pos)
 

函数

void loadStylesheet (const QCString &name, StyleDataMap &map)
 
void loadExtensions (const QCString &name)
 

变量

QCString rtf_title
 
QCString rtf_subject
 
QCString rtf_comments
 
QCString rtf_company
 
QCString rtf_logoFilename
 
QCString rtf_author
 
QCString rtf_manager
 
QCString rtf_documentType
 
QCString rtf_documentId
 
QCString rtf_keywords
 
static std::map< std::string, QCString & > g_styleMap
 
char rtf_Style_Reset [] = "\\pard\\plain "
 
Rtf_Style_Default rtf_Style_Default []
 
static const reg::Ex s_clause (R"(\\s(\d+)\s*)")
 
StyleDataMap rtf_Style
 

宏定义说明

◆ RTF_CodeExample

#define RTF_CodeExample (   lvl,
  nest,
  nxt,
  pos 
)
值:
{ "CodeExample"#lvl, \
"\\s"#nest"\\li"#pos"\\widctlpar\\adjustright \\shading1000\\cbpat8 \\f2\\fs16\\cgrid ", \
"\\sbasedon0 \\snext"#nxt" Code Example "#lvl \
}

在文件 rtfstyle.cpp70 行定义.

◆ RTF_DescContinue

#define RTF_DescContinue (   lvl,
  nest,
  nxt,
  pos 
)
值:
{ "DescContinue"#lvl, \
"\\s"#nest"\\li"#pos"\\widctlpar\\ql\\adjustright \\fs20\\cgrid ", \
"\\sbasedon0 \\snext"#nxt" DescContinue "#lvl \
}

在文件 rtfstyle.cpp82 行定义.

◆ RTF_LatexToc

#define RTF_LatexToc (   lvl,
  nest,
  nxt,
  pos,
  twps 
)
值:
\
{ "LatexTOC"#lvl, \
"\\s"#nest"\\li"#pos"\\sa"#twps"\\sb"#twps"\\widctlpar\\tqr\\tldot\\tx8640\\adjustright \\fs20\\cgrid ",\
"\\sbasedon0 \\snext"#nxt" LatexTOC "#lvl \
}

在文件 rtfstyle.cpp51 行定义.

◆ RTF_ListBullet

#define RTF_ListBullet (   lvl,
  nest,
  nxt,
  pos,
  lvl2 
)
值:
{ "ListBullet"#lvl, \
"\\s"#nest"\\fi-360\\li"#pos"\\widctlpar\\jclisttab\\tx"#pos"{\\*\\pn \\pnlvlbody\\ilvl0\\ls"#lvl2"\\pnrnot0\\pndec }\\ls1\\adjustright \\fs20\\cgrid ", \
"\\sbasedon0 \\snext"#nxt" \\sautoupd List Bullet "#lvl \
}

在文件 rtfstyle.cpp58 行定义.

◆ RTF_ListContinue

#define RTF_ListContinue (   lvl,
  nest,
  nxt,
  pos 
)
值:
{ "ListContinue"#lvl, \
"\\s"#nest"\\li"#pos"\\sa60\\sb30\\qj\\widctlpar\\qj\\adjustright \\fs20\\cgrid ", \
"\\sbasedon0 \\snext"#nxt" List Continue "#lvl \
}

在文件 rtfstyle.cpp76 行定义.

◆ RTF_ListEnum

#define RTF_ListEnum (   lvl,
  nest,
  nxt,
  pos 
)
值:
{ "ListEnum"#lvl, \
"\\s"#nest"\\fi-360\\li"#pos"\\widctlpar\\fs20\\cgrid ", \
"\\sbasedon0 \\snext"#nxt" \\sautoupd List Enum "#lvl \
}

在文件 rtfstyle.cpp64 行定义.

函数说明

◆ loadExtensions()

void loadExtensions ( const QCString name)

在文件 rtfstyle.cpp315 行定义.

316 {
317  std::ifstream file(name.str());
318  if (!file.is_open())
319  {
320  err("Can't open RTF extensions file %s. Using defaults.",qPrint(name));
321  return;
322  }
323  msg("Loading RTF extensions %s...\n",qPrint(name));
324 
325  uint lineNr=1;
326 
327  for (std::string line ; getline(file,line) ; ) // for each line
328  {
329  if (line.empty() || line[0]=='#') continue; // skip blanks & comments
330  static const reg::Ex assignment_splitter(R"(\s*=\s*)");
332  if (reg::search(line,match,assignment_splitter))
333  {
334  std::string key = match.prefix().str();
335  std::string value = match.suffix().str();
336  auto it = g_styleMap.find(key);
337  if (it!=g_styleMap.end())
338  {
339  it->second = value;
340  }
341  else
342  {
343  warn(name,lineNr,"Ignoring unknown extension key '%s'...",key.c_str());
344  }
345  }
346  else
347  {
348  warn(name,lineNr,"Assignment of style sheet name expected!");
349  }
350  lineNr++;
351  }
352 }

引用了 err(), g_styleMap, reg::match(), msg(), qPrint(), reg::search(), QCString::str() , 以及 warn().

被这些函数引用 RTFGenerator::init().

◆ loadStylesheet()

void loadStylesheet ( const QCString name,
StyleDataMap map 
)

在文件 rtfstyle.cpp273 行定义.

274 {
275  std::ifstream file(name.str());
276  if (!file.is_open())
277  {
278  err("Can't open RTF style sheet file %s. Using defaults.",qPrint(name));
279  return;
280  }
281  msg("Loading RTF style sheet %s...\n",qPrint(name));
282 
283  uint lineNr=1;
284 
285  for (std::string line ; getline(file,line) ; ) // for each line
286  {
287  if (line.empty() || line[0]=='#') continue; // skip blanks & comments
288  static const reg::Ex assignment_splitter(R"(\s*=\s*)");
290  if (reg::search(line,match,assignment_splitter))
291  {
292  std::string key = match.prefix().str();
293  std::string value = match.suffix().str();
294  auto it = map.find(key);
295  if (it!=map.end())
296  {
297  StyleData& styleData = it->second;
298  styleData.setStyle(value,key);
299  }
300  else
301  {
302  warn(name,lineNr,"Unknown style sheet name %s ignored.",key.data());
303  }
304  }
305  else
306  {
307  warn(name,lineNr,"Assignment of style sheet name expected line='%s'!",line.c_str());
308  }
309  lineNr++;
310  }
311 }

引用了 QCString::data(), err(), reg::match(), msg(), qPrint(), reg::search(), StyleData::setStyle(), QCString::str() , 以及 warn().

被这些函数引用 RTFGenerator::init().

变量说明

◆ g_styleMap

std::map<std::string,QCString &> g_styleMap
static
初始值:
=
{
{ "Title", rtf_title },
{ "Subject", rtf_subject },
{ "Comments", rtf_comments },
{ "Company", rtf_company },
{ "LogoFilename", rtf_logoFilename },
{ "Author", rtf_author },
{ "Manager", rtf_manager },
{ "DocumentType", rtf_documentType },
{ "DocumentId", rtf_documentId },
{ "Keywords", rtf_keywords }
}

在文件 rtfstyle.cpp34 行定义.

被这些函数引用 loadExtensions().

◆ rtf_author

QCString rtf_author

在文件 rtfstyle.cpp28 行定义.

被这些函数引用 RTFGenerator::endIndexSection() , 以及 RTFGenerator::startIndexSection().

◆ rtf_comments

QCString rtf_comments

在文件 rtfstyle.cpp25 行定义.

被这些函数引用 RTFGenerator::startIndexSection().

◆ rtf_company

QCString rtf_company

在文件 rtfstyle.cpp26 行定义.

被这些函数引用 RTFGenerator::endIndexSection() , 以及 RTFGenerator::startIndexSection().

◆ rtf_documentId

QCString rtf_documentId

在文件 rtfstyle.cpp31 行定义.

被这些函数引用 RTFGenerator::endIndexSection().

◆ rtf_documentType

QCString rtf_documentType

在文件 rtfstyle.cpp30 行定义.

被这些函数引用 RTFGenerator::endIndexSection() , 以及 RTFGenerator::startIndexSection().

◆ rtf_keywords

QCString rtf_keywords

在文件 rtfstyle.cpp32 行定义.

被这些函数引用 RTFGenerator::startIndexSection().

◆ rtf_logoFilename

QCString rtf_logoFilename

在文件 rtfstyle.cpp27 行定义.

被这些函数引用 RTFGenerator::endIndexSection().

◆ rtf_manager

QCString rtf_manager

在文件 rtfstyle.cpp29 行定义.

被这些函数引用 RTFGenerator::startIndexSection().

◆ rtf_Style

◆ rtf_Style_Default

Rtf_Style_Default rtf_Style_Default[]

在文件 rtfstyle.cpp88 行定义.

被这些函数引用 RTFGenerator::init() , 以及 RTFGenerator::writeStyleSheetFile().

◆ rtf_Style_Reset

◆ rtf_subject

QCString rtf_subject

在文件 rtfstyle.cpp24 行定义.

被这些函数引用 RTFGenerator::startIndexSection().

◆ rtf_title

QCString rtf_title

在文件 rtfstyle.cpp23 行定义.

被这些函数引用 RTFGenerator::endIndexSection().

◆ s_clause

const reg::Ex s_clause(R"(\\s(\d+)\s*)")
static

被这些函数引用 StyleData::setStyle() , 以及 StyleData::StyleData().

reg::match
bool match(const std::string &str, Match &match, const Ex &re)
Matches a given string str for a match against regular expression re.
Definition: regex.cpp:729
QCString::str
std::string str() const
Definition: qcstring.h:442
err
void err(const char *fmt,...)
Definition: message.cpp:203
rtf_company
QCString rtf_company
Definition: rtfstyle.cpp:26
warn
void warn(const QCString &file, int line, const char *fmt,...)
Definition: message.cpp:151
StyleData
Definition: rtfstyle.h:48
rtf_keywords
QCString rtf_keywords
Definition: rtfstyle.cpp:32
uint
unsigned uint
Definition: qcstring.h:40
g_styleMap
static std::map< std::string, QCString & > g_styleMap
Definition: rtfstyle.cpp:34
rtf_documentType
QCString rtf_documentType
Definition: rtfstyle.cpp:30
reg::Match
Object representing the matching results.
Definition: regex.h:163
rtf_author
QCString rtf_author
Definition: rtfstyle.cpp:28
StyleData::setStyle
bool setStyle(const std::string &command, const std::string &styleName)
Definition: rtfstyle.cpp:252
rtf_logoFilename
QCString rtf_logoFilename
Definition: rtfstyle.cpp:27
rtf_documentId
QCString rtf_documentId
Definition: rtfstyle.cpp:31
rtf_title
QCString rtf_title
Definition: rtfstyle.cpp:23
reg::Ex
Class representing a regular expression.
Definition: regex.h:48
msg
void msg(const char *fmt,...)
Definition: message.cpp:53
qPrint
const char * qPrint(const char *s)
Definition: qcstring.h:589
rtf_manager
QCString rtf_manager
Definition: rtfstyle.cpp:29
rtf_subject
QCString rtf_subject
Definition: rtfstyle.cpp:24
rtf_comments
QCString rtf_comments
Definition: rtfstyle.cpp:25
reg::search
bool search(const std::string &str, Match &match, const Ex &re, size_t pos)
Search in a given string str starting at position pos for a match against regular expression re.
Definition: regex.cpp:718