Grantlee 0.1.9
textdocument/lib/mediawikimarkupbuilder.h
00001 /*
00002   This file is part of the Grantlee template system.
00003 
00004   Copyright (c) 2008 Stephen Kelly <steveire@gmail.com>
00005 
00006   This library is free software; you can redistribute it and/or
00007   modify it under the terms of the GNU Lesser General Public
00008   License as published by the Free Software Foundation; either version
00009   2.1 of the Licence, or (at your option) any later version.
00010 
00011   This library is distributed in the hope that it will be useful,
00012   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014   Lesser General Public License for more details.
00015 
00016   You should have received a copy of the GNU Lesser General Public
00017   License along with this library.  If not, see <http://www.gnu.org/licenses/>.
00018 
00019 */
00020 
00021 #ifndef GRANTLEE_MEDIAWIKIMARKUPBUILDER_H
00022 #define GRANTLEE_MEDIAWIKIMARKUPBUILDER_H
00023 
00024 #include "abstractmarkupbuilder.h"
00025 
00026 namespace Grantlee
00027 {
00028 
00032 class MediaWikiMarkupBuilder : public AbstractMarkupBuilder
00033 {
00034 public:
00035 
00039   MediaWikiMarkupBuilder();
00040   virtual ~MediaWikiMarkupBuilder();
00041 
00042   /* reimp */ void beginStrong();
00043   /* reimp */ void endStrong();
00044   /* reimp */ void beginEmph();
00045   /* reimp */ void endEmph();
00046   /* reimp */ void beginUnderline();
00047   /* reimp */ void endUnderline();
00048   /* reimp */ void beginStrikeout();
00049   /* reimp */ void endStrikeout();
00050 
00051   /* reimp */ void endParagraph();
00052   /* reimp */ void addNewline();
00053 
00054   /* reimp */ void beginAnchor( const QString &href = QString(), const QString &name = QString() );
00055   /* reimp */ void endAnchor();
00056 
00057   /* reimp */ void beginHeader( int level );
00058   /* reimp */ void endHeader( int level );
00059 
00060   /* reimp */ void beginList( QTextListFormat::Style type );
00061 
00062   /* reimp */ void endList();
00063 
00064   /* reimp */ void beginListItem();
00065   /* reimp */ void endListItem();
00066 
00067   /* reimp */ void appendLiteralText( const QString &text );
00068 
00072   const QString escape( const QString &s );
00073 
00074   /* reimp */ QString getResult();
00075 
00076 private:
00077   QList<QTextListFormat::Style> currentListItemStyles;
00078 
00079   QString m_text;
00080 };
00081 
00082 }
00083 
00084 #endif