ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/Iffy/Tag.hpp
Revision: 277
Committed: 2004-11-13T14:01:11-08:00 (20 years, 7 months ago) by Douglas Thrift
File size: 1182 byte(s)
Log Message:
This might just work.

File Contents

# Content
1 // 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 Tag& operator=(const ext::String& name) { this->name = name; return *this; }
25 bool operator==(TagType type) const { return this->type == type; }
26 bool operator==(const ext::String& name) const { return this->name == name; }
27 bool operator!=(TagType type) const { return this->type != type; }
28 bool operator!=(const ext::String& name) const { return this->name != name; }
29 operator TagType() const { return type; }
30 operator ext::String() const { return name; }
31 // friends:
32 friend ios::PrintWriter& operator<<(ios::PrintWriter& pout, const Tag& tag);
33 };
34
35 inline ios::PrintWriter& operator<<(ios::PrintWriter& pout, const Tag& tag)
36 {
37 pout << (tag == CLOSE ? "</" : "<") << tag.name;
38
39 if (tag != CLOSE) pout << tag.attributes;
40
41 return pout << (tag == STANDALONE ? "/>" : ">");
42 }
43
44 #endif // _Tag_hpp_

Properties

Name Value
svn:eol-style native
svn:keywords Id