2 Copyright (c) 2006 Paolo Capriotti <p.capriotti@sns.it>
3 (c) 2006 Maurizio Monge <maurizio.monge@kdemail.net>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
14 #include <QSyntaxHighlighter>
15 #include <QTextCharFormat>
16 #include <boost/shared_ptr.hpp>
18 class PatternListAdaptorOutputIterator
;
19 class PatternListAdaptorInputIterator
;
21 class Highlighter
: public QSyntaxHighlighter
{
27 QTextCharFormat format
;
30 std::vector
<Pattern
> m_patterns
;
32 Highlighter(QTextDocument
* parent
);
33 Highlighter(QTextDocument
* parent
, const Pattern
& pattern
);
36 static void load(PatternListAdaptorOutputIterator
& out
);
37 static void save(const PatternListAdaptorInputIterator
& in
);
39 virtual void highlightBlock(const QString
& text
);
40 std::vector
<Pattern
>& patterns();
44 class PatternListAdaptorOutputIterator
{
46 virtual ~PatternListAdaptorOutputIterator() { }
47 virtual void add(const Highlighter::Pattern
&) = 0;
50 class PatternListAdaptorInputIterator
{
52 virtual ~PatternListAdaptorInputIterator() { }
53 virtual boost::shared_ptr
<PatternListAdaptorInputIterator
> clone() const = 0;
54 virtual bool valid() const = 0;
55 virtual PatternListAdaptorInputIterator
& inc() = 0;
56 virtual const Highlighter::Pattern
& value() const = 0;
59 #endif // HIGHLIGHTER_H