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 141 by Douglas Thrift, 2004-03-25T19:21:58-08:00 vs.
Revision 142 by Douglas Thrift, 2004-03-31T20:53:28-08:00

# Line 57 | Line 57 | int main(int argc, char* argv[])
57   SiteMapper::SiteMapper(const string& siteIndex, const string& siteMap)
58   {
59          oldMap(siteMap);
60 <        index(siteIndex);
60 >        newIndex(siteIndex);
61          newMap(siteMap);
62   }
63  
# Line 112 | Line 112 | void SiteMapper::oldMap(vector<Page>& pa
112          }
113   }
114  
115 < void SiteMapper::index(const string& siteIndex)
115 > void SiteMapper::newIndex(const string& siteIndex)
116   {
117          XalanDOMString file(siteIndex.c_str());
118          LocalFileInputSource source(file.c_str());
# Line 149 | Line 149 | void SiteMapper::index(const string& sit
149                  title << evaluator.evaluate(support, node, *(this->title))->str();
150  
151                  Page page(address.str(), path.str(), title.str());
152 <                Matcher matcher("^Douglas Thrift's.+Website \\| (.+)$");
152 >                Matcher matcher;
153  
154 <                if (page == matcher)
154 >                if (page == matcher(string("^Douglas\\sThrift's\\sWebsite\\s\\|\\sDou")
155 >                        + "glas\\sThrift's\\sBlog:\\s(.+)$"))
156 >                {
157 >                        if (Matcher("^\\w+\\s\\d\\d\\d\\d\\sArchives$") == matcher[1])
158 >                        {
159 >                                page.setTitle(matcher[1]);
160 >
161 >                                if (newIndex(pages, page)) continue;
162 >                        }
163 >                        else continue;
164 >                }
165 >                else if (page == matcher("^Douglas\\sThrift's.+Website\\s\\|\\s(.+)$"))
166                  {
167                          page.setTitle(matcher[1]);
168  
169 <                        newPages.insert(page);
169 >                        if (newIndex(pages, page)) continue;
170                  }
171 +                else continue;
172 +
173 +                cerr << page.getTitle() << ' ' << page.getChildOf() << '\n';
174 + //              newPages.insert(page);
175          }
176  
177          evaluator.destroyXPath(address);
# Line 165 | Line 180 | void SiteMapper::index(const string& sit
180          evaluator.destroyXPath(title);
181   }
182  
183 + bool SiteMapper::newIndex(vector<Page>& pages, Page& page)
184 + {
185 +        for (unsigned index = 0; index < pages.size(); index++)
186 +        {
187 +                if (pages[index] == page.getAddress())
188 +                {
189 +                        Matcher matcher;
190 +
191 +                        if (pages[index] == page)
192 +                        {
193 +                                page.setChildren(pages[index].getChildren());
194 +
195 +                                pages[index] = page;
196 +
197 +                                return true;
198 +                        }
199 +                        else if (matcher('^' + pages[index].getPath()) == page)
200 +                        {
201 +                                page.setChildOf(matcher[0]);
202 +
203 +                                if (matcher('^' + pages[index].getTitle() + "\\s\\|\\s(.+)$")
204 +                                        == page)
205 +                                {
206 +                                        page.setTitle(matcher[1]);
207 +                                }
208 +
209 +                                return newIndex(pages[index].getChildren(), page);
210 +                        }
211 +                }
212 +        }
213 +
214 +        cerr << "Here!\n";
215 +
216 +        return false;
217 + }
218 +
219   void SiteMapper::newMap(const string& siteMap)
220   {
221          //

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines