1 |
Douglas Thrift |
276 |
// Iffy |
2 |
|
|
// |
3 |
|
|
// Douglas Thrift |
4 |
|
|
// |
5 |
|
|
// $Id$ |
6 |
|
|
|
7 |
|
|
#ifndef _Tag_hpp_ |
8 |
|
|
#define _Tag_hpp_ |
9 |
|
|
|
10 |
|
|
#include "Iffy.hpp" |
11 |
|
|
|
12 |
|
|
enum TagType { OPEN, CLOSE, STANDALONE }; |
13 |
|
|
|
14 |
|
|
class Tag |
15 |
|
|
{ |
16 |
|
|
private: |
17 |
|
|
TagType type; |
18 |
|
|
ext::String name; |
19 |
|
|
ios::String attributes; |
20 |
|
|
ext::String lower(const ext::String& string); |
21 |
|
|
public: |
22 |
|
|
Tag(const ext::String& segment); |
23 |
|
|
Tag& operator=(TagType type) { this->type = type; return *this; } |
24 |
|
|
bool operator==(TagType type) const { return this->type == type; } |
25 |
|
|
bool operator==(const ext::String& name) const { return this->name == name; } |
26 |
|
|
// friends: |
27 |
|
|
friend ios::PrintWriter& operator<<(ios::PrintWriter& pout, const Tag& tag); |
28 |
|
|
}; |
29 |
|
|
|
30 |
|
|
inline ios::PrintWriter& operator<<(ios::PrintWriter& pout, const Tag& tag) |
31 |
|
|
{ |
32 |
|
|
return pout << (tag.type == CLOSE ? "</" : "<") << tag.name << tag.attributes << (tag.type == STANDALONE ? "/>" : ">"); |
33 |
|
|
} |
34 |
|
|
|
35 |
|
|
#endif // _Tag_hpp_ |