ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/Iffy/Tag.hpp
Revision: 288
Committed: 2004-12-09T22:47:17-08:00 (20 years, 6 months ago) by douglas
File size: 1211 byte(s)
Log Message:
Hrm, not getting anywhere yet, but sort of figuring out what's wrong.

File Contents

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

Properties

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