textdocvisitor.cpp
Go to the documentation of this file.
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 <qdir.h>
20 #include "textdocvisitor.h"
21 #include "message.h"
22 #include "util.h"
23 #include "htmlentity.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 
40 
41 void TextDocVisitor::filter(const char *str)
42 {
43  if (str==0) return;
44  //printf("TextDocVisitor::filter(%s)\n",str);
45  const char *p=str;
46  char c;
47  while (*p)
48  {
49  c=*p++;
50  switch(c)
51  {
52  case '\n': m_t << " "; break;
53  case '"': m_t << "&quot;"; break;
54  case '\'': m_t << "&#39;"; break;
55  case '<': m_t << "&lt;"; break;
56  case '>': m_t << "&gt;"; break;
57  case '&': m_t << "&amp;"; break;
58  default: m_t << c;
59  }
60  }
61 }
62 
static HtmlEntityMapper * instance()
Definition: htmlentity.cpp:341
void visit(DocWord *w)
FTextStream & m_t
p
Definition: test.py:223
A bunch of utility functions.
const char * html(DocSymbol::SymType symb, bool useInPrintf=FALSE) const
Access routine to the html code of the HTML entity.
Definition: htmlentity.cpp:386
void err(const char *fmt,...)
Definition: message.cpp:226
SymType symbol() const
Definition: docparser.h:418
static QCString * s
Definition: config.cpp:1042
const bool TRUE
Definition: qglobal.h:371
void filter(const char *str)
static QCString str