ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/Iffy/Cleaner.cpp
Revision: 296
Committed: 2004-12-11T01:33:37-08:00 (20 years, 6 months ago) by douglas
File size: 825 byte(s)
Log Message:
Cosmetics.

File Contents

# User Rev Content
1 douglas 296 // Iffy
2 Douglas Thrift 284 //
3     // Douglas Thrift
4     //
5     // $Id$
6    
7     #include "Cleaner.hpp"
8    
9     void Cleaner::clean()
10     {
11 douglas 294 // XXX: do stuff
12    
13     if (segments.First().type != TAG || segments.First().tag != "html")
14     {
15     Tag tag(OPEN, "html");
16    
17     segments.InsertFirst(tag);
18     }
19    
20     if (segments.Last().type == TEXT)
21     {
22     std::string segment(segments.Last().text);
23    
24     if (segment.find_first_not_of("\r\n") == std::string::npos) segments.RemoveLast();
25     }
26    
27     if (segments.Last().type != TAG || segments.Last().tag != "html")
28     {
29     Tag tag(CLOSE, "html");
30    
31     segments.InsertLast(tag);
32     }
33 Douglas Thrift 284 }
34    
35     ios::PrintWriter& operator<<(ios::PrintWriter& pout, const Cleaner& cleaner)
36     {
37     _foreach (ext::Vector<Segment>, segment, cleaner.segments)
38     {
39     switch (segment->type)
40     {
41     case TEXT:
42     pout << segment->text;
43    
44     break;
45     case TAG:
46     pout << segment->tag;
47     }
48     }
49    
50     return pout;
51     }

Properties

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