00001 /****************************************************************************** 00002 * 00003 * $Id: $ 00004 * 00005 * 00006 * Copyright (C) 1997-2008 by Dimitri van Heesch. 00007 * 00008 * Permission to use, copy, modify, and distribute this software and its 00009 * documentation under the terms of the GNU General Public License is hereby 00010 * granted. No representations are made about the suitability of this software 00011 * for any purpose. It is provided "as is" without express or implied warranty. 00012 * See the GNU General Public License for more details. 00013 * 00014 * Documents produced by Doxygen are derivative works derived from the 00015 * input used in their production; they are not affected by this license. 00016 * 00017 */ 00018 00019 #include <qdir.h> 00020 #include "textdocvisitor.h" 00021 #include "message.h" 00022 00023 //------------------------------------------------------------------------- 00024 00025 void TextDocVisitor::visit(DocSymbol *s) 00026 { 00027 switch(s->symbol()) 00028 { 00029 case DocSymbol::BSlash: m_t << "\\"; break; 00030 case DocSymbol::At: m_t << "@"; break; 00031 case DocSymbol::Less: m_t << "<"; break; 00032 case DocSymbol::Greater: m_t << ">"; break; 00033 case DocSymbol::Amp: m_t << "&"; break; 00034 case DocSymbol::Dollar: m_t << "$"; break; 00035 case DocSymbol::Hash: m_t << "#"; break; 00036 case DocSymbol::Percent: m_t << "%"; break; 00037 case DocSymbol::Copy: m_t << "©"; break; 00038 case DocSymbol::Tm: m_t << "&tm;"; break; 00039 case DocSymbol::Reg: m_t << "®"; break; 00040 case DocSymbol::Apos: m_t << "'"; break; 00041 case DocSymbol::Quot: m_t << "\""; break; 00042 case DocSymbol::Lsquo: m_t << "‘"; break; 00043 case DocSymbol::Rsquo: m_t << "’"; break; 00044 case DocSymbol::Ldquo: m_t << "“"; break; 00045 case DocSymbol::Rdquo: m_t << "”"; break; 00046 case DocSymbol::Ndash: m_t << "–"; break; 00047 case DocSymbol::Mdash: m_t << "—"; break; 00048 case DocSymbol::Uml: m_t << "&" << s->letter() << "uml;"; break; 00049 case DocSymbol::Acute: m_t << "&" << s->letter() << "acute;"; break; 00050 case DocSymbol::Grave: m_t << "&" << s->letter() << "grave;"; break; 00051 case DocSymbol::Circ: m_t << "&" << s->letter() << "circ;"; break; 00052 case DocSymbol::Slash: m_t << "&" << s->letter() << "slash;"; break; 00053 case DocSymbol::Tilde: m_t << "&" << s->letter() << "tilde;"; break; 00054 case DocSymbol::Szlig: m_t << "ß"; break; 00055 case DocSymbol::Cedil: m_t << "&" << s->letter() << "cedil;"; break; 00056 case DocSymbol::Ring: m_t << "&" << s->letter() << "ring;"; break; 00057 case DocSymbol::Nbsp: m_t << " "; break; 00058 default: 00059 err("Error: unknown symbol found\n"); 00060 } 00061 } 00062 00063 00064 void TextDocVisitor::filter(const char *str) 00065 { 00066 if (str==0) return; 00067 const char *p=str; 00068 char c; 00069 while (*p) 00070 { 00071 c=*p++; 00072 switch(c) 00073 { 00074 case '\n': m_t << " "; break; 00075 case '"': m_t << """; break; 00076 case '\'': m_t << "'"; break; 00077 case '<': m_t << "<"; break; 00078 case '>': m_t << ">"; break; 00079 case '&': m_t << "&"; break; 00080 default: m_t << c; 00081 } 00082 } 00083 } 00084