Orb/Doxygen/src/textdocvisitor.cpp
changeset 0 42188c7ea2d9
child 4 468f4c8d3d5b
equal deleted inserted replaced
-1:000000000000 0:42188c7ea2d9
       
     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 << "&lt;"; break;
       
    32     case DocSymbol::Greater: m_t << "&gt;"; break;
       
    33     case DocSymbol::Amp:     m_t << "&amp;"; 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 << "&copy;"; break;
       
    38     case DocSymbol::Tm:      m_t << "&tm;"; break;
       
    39     case DocSymbol::Reg:     m_t << "&reg;"; break;
       
    40     case DocSymbol::Apos:    m_t << "'"; break;
       
    41     case DocSymbol::Quot:    m_t << "\""; break;
       
    42     case DocSymbol::Lsquo:   m_t << "&lsquo;"; break;
       
    43     case DocSymbol::Rsquo:   m_t << "&rsquo;"; break;
       
    44     case DocSymbol::Ldquo:   m_t << "&ldquo;"; break;
       
    45     case DocSymbol::Rdquo:   m_t << "&rdquo;"; break;
       
    46     case DocSymbol::Ndash:   m_t << "&ndash;"; break;
       
    47     case DocSymbol::Mdash:   m_t << "&mdash;"; 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 << "&szlig;"; 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 << "&nbsp;"; break;
       
    58     case DocSymbol::Aelig:   m_t << "&aelig;"; break;
       
    59     case DocSymbol::AElig:   m_t << "&AElig;"; 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 << "&quot;"; break;
       
    78       case '\'':  m_t << "&#39;";  break;
       
    79       case '<':   m_t << "&lt;";   break;
       
    80       case '>':   m_t << "&gt;";   break;
       
    81       case '&':   m_t << "&amp;";  break;
       
    82       default:    m_t << c;
       
    83     }
       
    84   }
       
    85 }
       
    86