ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/SiteMapper/SiteMapper.cpp
(Generate patch)

Comparing SiteMapper/SiteMapper.cpp (file contents):
Revision 138 by Douglas Thrift, 2004-03-25T15:52:54-08:00 vs.
Revision 140 by Douglas Thrift, 2004-03-25T18:04:04-08:00

# Line 80 | Line 80 | void SiteMapper::oldMap(const string& si
80          item = evaluator.createXPath(XalanDOMString("item").c_str());
81          address = evaluator.createXPath(XalanDOMString("link/@address").c_str());
82          link = evaluator.createXPath(XalanDOMString("link").c_str());
83 <        this->list = evaluator.createXPath(XalanDOMString("list").c_str());
83 >        list_ = evaluator.createXPath(XalanDOMString("list").c_str());
84  
85          oldMap(pages, list);
86  
87          evaluator.destroyXPath(item);
88          evaluator.destroyXPath(address);
89          evaluator.destroyXPath(link);
90 <        evaluator.destroyXPath(this->list);
90 >        evaluator.destroyXPath(list_);
91   }
92  
93 < void SiteMapper::oldMap(vector<Page>& pages, XalanNode* list)
93 > void SiteMapper::oldMap(list<Page>& pages, XalanNode* list)
94   {
95          NodeRefList nodes = evaluator.selectNodeList(support, list, *item);
96  
# Line 103 | Line 103 | void SiteMapper::oldMap(vector<Page>& pa
103                  title << evaluator.evaluate(support, node, *link)->str();
104  
105                  Page page(url.str(), title.str());
106 <                XalanNode* list = evaluator.selectSingleNode(support, node,
107 <                        *(this->list));
106 >                XalanNode* list = evaluator.selectSingleNode(support, node, *list_);
107  
108                  if (list != 0) oldMap(page.getChildren(), list);
109  
# Line 122 | Line 121 | void SiteMapper::index(const string& sit
121          if (document == 0) return;
122  
123          address = evaluator.createXPath(XalanDOMString("address").c_str());
125        path = evaluator.createXPath(XalanDOMString("path").c_str());
124          port = evaluator.createXPath(XalanDOMString("port").c_str());
125 +        path = evaluator.createXPath(XalanDOMString("path").c_str());
126          title = evaluator.createXPath(XalanDOMString("title").c_str());
127          
128          NodeRefList nodes = evaluator.selectNodeList(support, document,
# Line 132 | Line 131 | void SiteMapper::index(const string& sit
131          for (int index = 0; index < nodes.getLength(); index++)
132          {
133                  XalanNode* node = nodes.item(index);
134 +                ostringstream address;
135 +
136 +                address << evaluator.evaluate(support, node, *(this->address))->str();
137 +
138 +                double port = evaluator.evaluate(support, node, *(this->port))->num();
139 +
140 +                if (port >= 0 && port <= 65535)
141 +                {
142 +                        address << ':' << int(port);
143 +                }
144 +
145 +                ostringstream path, title;
146 +
147 +                path << evaluator.evaluate(support, node, *(this->path))->str();
148 +                title << evaluator.evaluate(support, node, *(this->title))->str();
149 +
150 +                Page page(address.str(), path.str(), title.str());
151 +                Matcher matcher("^Douglas Thrift's.+Website \\| (.+)$");
152 +
153 +                if (page == matcher)
154 +                {
155 +                        page.setTitle(matcher[1]);
156 +
157 +                        newPages.insert(page);
158 +                }
159          }
160  
161          evaluator.destroyXPath(address);
138        evaluator.destroyXPath(path);
162          evaluator.destroyXPath(port);
163 +        evaluator.destroyXPath(path);
164          evaluator.destroyXPath(title);
165   }
166  
# Line 144 | Line 168 | void SiteMapper::newMap(const string& si
168   {
169          //
170  
171 <        for (int index = 0; index < pages.size(); index++)
171 >        for (list<Page>::iterator itor = pages.begin(); itor != pages.end();
172 >                itor++)
173          {
174 <                cout << pages[index] << '\n';
174 >                cout << *itor << '\n';
175          }
176   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines