1 |
// Iffy |
2 |
// |
3 |
// Douglas Thrift |
4 |
// |
5 |
// $Id$ |
6 |
|
7 |
#ifndef _Cleaner_hpp_ |
8 |
#define _Cleaner_hpp_ |
9 |
|
10 |
#include "Tag.hpp" |
11 |
|
12 |
enum SegmentType { TEXT, TAG }; |
13 |
|
14 |
struct Segment |
15 |
{ |
16 |
SegmentType type; |
17 |
ext::String text; |
18 |
Tag tag; |
19 |
Segment() : type(TEXT) {} |
20 |
Segment(const ext::String& text) : type(TEXT), text(text) {} |
21 |
Segment(const Tag& tag) : type(TAG), tag(tag) {} |
22 |
}; |
23 |
|
24 |
class Cleaner |
25 |
{ |
26 |
private: |
27 |
ext::Vector<Segment> segments; |
28 |
public: |
29 |
template <typename Type> |
30 |
void insert(const Type& type) { segments.InsertLast(type); } |
31 |
void clean(); |
32 |
// friends: |
33 |
friend ios::PrintWriter& operator<<(ios::PrintWriter& pout, const Cleaner& cleaner); |
34 |
}; |
35 |
|
36 |
#endif // _Cleaner_hpp_ |