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