Doxygen
textdocvisitor.cpp
浏览该文件的文档.
1 /******************************************************************************
2  *
3  *
4  *
5  *
6  * Copyright (C) 1997-2015 by Dimitri van Heesch.
7  *
8  * Permission to use, copy, modify, and distribute this software and its
9  * documentation under the terms of the GNU General Public License is hereby
10  * granted. No representations are made about the suitability of this software
11  * for any purpose. It is provided "as is" without express or implied warranty.
12  * See the GNU General Public License for more details.
13  *
14  * Documents produced by Doxygen are derivative works derived from the
15  * input used in their production; they are not affected by this license.
16  *
17  */
18 
19 #include "textdocvisitor.h"
20 #include "message.h"
21 #include "util.h"
22 #include "htmlentity.h"
23 #include "emoji.h"
24 
25 //-------------------------------------------------------------------------
26 
28 {
29  const char *res = HtmlEntityMapper::instance()->html(s->symbol());
30  if (res)
31  {
32  m_t << res;
33  }
34  else
35  {
36  err("text: non supported HTML-entity found: %s\n",HtmlEntityMapper::instance()->html(s->symbol(),TRUE));
37  }
38 }
39 
41 {
42  const char *res = EmojiEntityMapper::instance()->name(s->index());
43  if (res)
44  {
45  filter(res);
46  }
47  else
48  {
49  filter(s->name());
50  }
51 }
52 
54 {
55  if (str.isEmpty()) return;
56  //printf("TextDocVisitor::filter(%s)\n",str);
57  const char *p=str.data();
58  char c;
59  while (*p)
60  {
61  c=*p++;
62  switch(c)
63  {
64  case '\n': m_t << " "; break;
65  default: m_t << c;
66  }
67  }
68 }
69 
QCString::isEmpty
bool isEmpty() const
Returns TRUE iff the string is empty
Definition: qcstring.h:144
DocEmoji
Node representing a n emoji
Definition: docparser.h:469
DocEmoji::name
QCString name() const
Definition: docparser.h:473
err
void err(const char *fmt,...)
Definition: message.cpp:203
TextDocVisitor::m_t
TextStream & m_t
Definition: textdocvisitor.h:155
HtmlEntityMapper::instance
static HtmlEntityMapper * instance()
Returns the one and only instance of the HTML entity mapper
Definition: htmlentity.cpp:341
DocSymbol::symbol
SymType symbol() const
Definition: docparser.h:459
DocSymbol
Node representing a special symbol
Definition: docparser.h:385
EmojiEntityMapper::name
const char * name(int index) const
Access routine to the name of the Emoji entity
Definition: emoji.cpp:1590
message.h
textdocvisitor.h
TRUE
#define TRUE
Definition: qcstring.h:36
DocEmoji::index
int index() const
Definition: docparser.h:474
HtmlEntityMapper::html
const char * html(DocSymbol::SymType symb, bool useInPrintf=FALSE) const
Access routine to the html code of the HTML entity
Definition: htmlentity.cpp:386
QCString::data
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string
Definition: qcstring.h:153
emoji.h
EmojiEntityMapper::instance
static EmojiEntityMapper * instance()
Returns the one and only instance of the Emoji entity mapper
Definition: emoji.cpp:1536
TextDocVisitor::visit
void visit(DocWord *w)
Definition: textdocvisitor.h:53
htmlentity.h
TextDocVisitor::filter
void filter(const QCString &str)
Definition: textdocvisitor.cpp:53
util.h
A bunch of utility functions.
QCString
This is an alternative implementation of QCString.
Definition: qcstring.h:108