SF# 3175310

This commit is contained in:
Marian Krivos 2011-08-18 16:57:01 +00:00
parent 1a14a27104
commit fbe704af43

View File

@ -16,14 +16,14 @@
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
@ -95,51 +95,51 @@ Path::Path(const char* path, Style style)
}
Path::Path(const Path& path):
_node(path._node),
Path::Path(const Path& path):
_node(path._node),
_device(path._device),
_name(path._name),
_version(path._version),
_dirs(path._dirs),
_absolute(path._absolute)
{
{
}
Path::Path(const Path& parent, const std::string& fileName):
_node(parent._node),
_node(parent._node),
_device(parent._device),
_name(parent._name),
_version(parent._version),
_dirs(parent._dirs),
_absolute(parent._absolute)
{
{
makeDirectory();
_name = fileName;
}
Path::Path(const Path& parent, const char* fileName):
_node(parent._node),
_node(parent._node),
_device(parent._device),
_name(parent._name),
_version(parent._version),
_dirs(parent._dirs),
_absolute(parent._absolute)
{
{
makeDirectory();
_name = fileName;
}
Path::Path(const Path& parent, const Path& relative):
_node(parent._node),
_node(parent._node),
_device(parent._device),
_name(parent._name),
_version(parent._version),
_dirs(parent._dirs),
_absolute(parent._absolute)
{
{
resolve(relative);
}
@ -148,13 +148,13 @@ Path::~Path()
{
}
Path& Path::operator = (const Path& path)
{
return assign(path);
}
Path& Path::operator = (const std::string& path)
{
return assign(path);
@ -206,7 +206,7 @@ Path& Path::assign(const std::string& path)
return *this;
}
Path& Path::assign(const std::string& path, Style style)
{
switch (style)
@ -250,7 +250,7 @@ std::string Path::toString() const
#endif
}
std::string Path::toString(Style style) const
{
switch (style)
@ -456,36 +456,36 @@ void Path::setNode(const std::string& node)
_absolute = _absolute || !node.empty();
}
void Path::setDevice(const std::string& device)
{
_device = device;
_absolute = _absolute || !device.empty();
}
const std::string& Path::directory(int n) const
{
poco_assert (0 <= n && n <= _dirs.size());
if (n < _dirs.size())
return _dirs[n];
else
return _name;
return _name;
}
const std::string& Path::operator [] (int n) const
{
poco_assert (0 <= n && n <= _dirs.size());
if (n < _dirs.size())
return _dirs[n];
else
return _name;
return _name;
}
void Path::pushDirectory(const std::string& dir)
{
if (!dir.empty() && dir != ".")
@ -512,15 +512,15 @@ void Path::pushDirectory(const std::string& dir)
}
}
void Path::popDirectory()
{
poco_assert (!_dirs.empty());
_dirs.pop_back();
}
void Path::setFileName(const std::string& name)
{
_name = name;
@ -559,7 +559,7 @@ void Path::setExtension(const std::string& extension)
}
}
std::string Path::getExtension() const
{
std::string::size_type pos = _name.rfind('.');
@ -586,13 +586,13 @@ std::string Path::current()
return PathImpl::currentImpl();
}
std::string Path::home()
{
return PathImpl::homeImpl();
}
std::string Path::temp()
{
return PathImpl::tempImpl();
@ -604,7 +604,7 @@ std::string Path::null()
return PathImpl::nullImpl();
}
std::string Path::expand(const std::string& path)
{
return PathImpl::expandImpl(path);
@ -652,7 +652,7 @@ void Path::parseUnix(const std::string& path)
if (it != end)
{
if (*it == '/')
if (*it == '/')
{
_absolute = true; ++it;
}
@ -677,7 +677,10 @@ void Path::parseUnix(const std::string& path)
if (_dirs.empty())
{
if (!name.empty() && *(name.rbegin()) == ':')
{
_device.assign(name, 0, name.length() - 1);
_absolute = true;
}
else
pushDirectory(name);
}
@ -777,7 +780,7 @@ void Path::parseVMS(const std::string& path)
}
}
}
}
}
if (name.empty())
{
if (it != end && *it == '[')
@ -803,7 +806,7 @@ void Path::parseVMS(const std::string& path)
{
if (_dirs.empty() || _dirs.back() == "..")
_dirs.push_back("..");
else
else
_dirs.pop_back();
}
else _dirs.push_back(name);
@ -874,7 +877,7 @@ void Path::parseGuess(const std::string& path)
case '\\': hasBackslash = true; break;
case '/': hasSlash = true; break;
case '[': hasOpenBracket = true;
case ']': hasClosBracket = hasOpenBracket;
case ']': hasClosBracket = hasOpenBracket;
case ';': semiIt = it; break;
}
}