|
1 /****************************************************************************** |
|
2 * |
|
3 * |
|
4 * |
|
5 * |
|
6 * Copyright (C) 1997-2008 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 |
|
23 //------------------------------------------------------------------------- |
|
24 |
|
25 void TextDocVisitor::visit(DocSymbol *s) |
|
26 { |
|
27 switch(s->symbol()) |
|
28 { |
|
29 case DocSymbol::BSlash: m_t << "\\"; break; |
|
30 case DocSymbol::At: m_t << "@"; break; |
|
31 case DocSymbol::Less: m_t << "<"; break; |
|
32 case DocSymbol::Greater: m_t << ">"; break; |
|
33 case DocSymbol::Amp: m_t << "&"; break; |
|
34 case DocSymbol::Dollar: m_t << "$"; break; |
|
35 case DocSymbol::Hash: m_t << "#"; break; |
|
36 case DocSymbol::Percent: m_t << "%"; break; |
|
37 case DocSymbol::Copy: m_t << "©"; break; |
|
38 case DocSymbol::Tm: m_t << "&tm;"; break; |
|
39 case DocSymbol::Reg: m_t << "®"; break; |
|
40 case DocSymbol::Apos: m_t << "'"; break; |
|
41 case DocSymbol::Quot: m_t << "\""; break; |
|
42 case DocSymbol::Lsquo: m_t << "‘"; break; |
|
43 case DocSymbol::Rsquo: m_t << "’"; break; |
|
44 case DocSymbol::Ldquo: m_t << "“"; break; |
|
45 case DocSymbol::Rdquo: m_t << "”"; break; |
|
46 case DocSymbol::Ndash: m_t << "–"; break; |
|
47 case DocSymbol::Mdash: m_t << "—"; break; |
|
48 case DocSymbol::Uml: m_t << "&" << s->letter() << "uml;"; break; |
|
49 case DocSymbol::Acute: m_t << "&" << s->letter() << "acute;"; break; |
|
50 case DocSymbol::Grave: m_t << "&" << s->letter() << "grave;"; break; |
|
51 case DocSymbol::Circ: m_t << "&" << s->letter() << "circ;"; break; |
|
52 case DocSymbol::Slash: m_t << "&" << s->letter() << "slash;"; break; |
|
53 case DocSymbol::Tilde: m_t << "&" << s->letter() << "tilde;"; break; |
|
54 case DocSymbol::Szlig: m_t << "ß"; break; |
|
55 case DocSymbol::Cedil: m_t << "&" << s->letter() << "cedil;"; break; |
|
56 case DocSymbol::Ring: m_t << "&" << s->letter() << "ring;"; break; |
|
57 case DocSymbol::Nbsp: m_t << " "; break; |
|
58 case DocSymbol::Aelig: m_t << "æ"; break; |
|
59 case DocSymbol::AElig: m_t << "Æ"; break; |
|
60 default: |
|
61 err("Error: unknown symbol found\n"); |
|
62 } |
|
63 } |
|
64 |
|
65 |
|
66 void TextDocVisitor::filter(const char *str) |
|
67 { |
|
68 if (str==0) return; |
|
69 const char *p=str; |
|
70 char c; |
|
71 while (*p) |
|
72 { |
|
73 c=*p++; |
|
74 switch(c) |
|
75 { |
|
76 case '\n': m_t << " "; break; |
|
77 case '"': m_t << """; break; |
|
78 case '\'': m_t << "'"; break; |
|
79 case '<': m_t << "<"; break; |
|
80 case '>': m_t << ">"; break; |
|
81 case '&': m_t << "&"; break; |
|
82 default: m_t << c; |
|
83 } |
|
84 } |
|
85 } |
|
86 |