summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d7d9ec2)
raw | patch | inline | side by side (parent: d7d9ec2)
author | ishmal <ishmal@users.sourceforge.net> | |
Sat, 22 Apr 2006 21:50:15 +0000 (21:50 +0000) | ||
committer | ishmal <ishmal@users.sourceforge.net> | |
Sat, 22 Apr 2006 21:50:15 +0000 (21:50 +0000) |
src/dom/uri.cpp | patch | blob | history |
diff --git a/src/dom/uri.cpp b/src/dom/uri.cpp
index 59a965b8d942b84ab1c6ee8e95053d3e7ce1c02a..e65c5edffdd4fa47aedaedea3c3e9508c9de450d 100644 (file)
--- a/src/dom/uri.cpp
+++ b/src/dom/uri.cpp
DOMString tpath = path.substr(0, pos+1);
tpath.append(other.path);
newUri.path = tpath;
- newUri.normalize();
}
}
}
+ newUri.normalize();
return newUri;
}
//## Collect segments
if (path.size()<2)
return;
+ bool abs = false;
unsigned int pos=0;
+ if (path[0]=='/')
+ {
+ abs = true;
+ pos++;
+ }
while (pos < path.size())
{
- unsigned int pos2 = path.find(pos);
+ unsigned int pos2 = path.find('/', pos);
if (pos2==path.npos)
+ {
+ DOMString seg = path.substr(pos);
+ //printf("last segment:%s\n", seg.c_str());
+ segments.push_back(seg);
break;
+ }
if (pos2>pos)
{
- DOMString seg = path.substr(pos, pos2);
+ DOMString seg = path.substr(pos, pos2-pos);
+ //printf("segment:%s\n", seg.c_str());
segments.push_back(seg);
}
pos = pos2;
if (edited)
{
path.clear();
- if (absolute)
+ if (abs)
+ {
path.append("/");
+ }
std::vector<DOMString>::iterator iter;
for (iter=segments.begin() ; iter!=segments.end() ; iter++)
{
+ if (iter != segments.begin())
+ path.append("/");
path.append(*iter);
- path.append("/");
}
}
int p = parse(0);
+ normalize();
if (p < 0)
{