Logo Search packages:      
Sourcecode: poco version File versions  Download package

void Poco::Path::parseUnix ( const std::string &  path  )  [protected]

On Windows, if POCO has been compiled with Windows UTF-8 support (POCO_WIN32_UTF8), this function converts a string (usually containing a path) encoded in UTF-8 into a string encoded in the current Windows code page.

This function should be used for every string passed as a file name to a string stream or fopen().

On all other platforms, or if POCO has not been compiled with Windows UTF-8 support, this function returns the string unchanged.

Definition at line 633 of file Path.cpp.

References _dirs, clear(), home(), and pushDirectory().

Referenced by assign().

{
      clear();

      std::string::const_iterator it  = path.begin();
      std::string::const_iterator end = path.end();

      if (it != end)
      {
            if (*it == '/') 
            {
                  _absolute = true; ++it;
            }
            else if (*it == '~')
            {
                  ++it;
                  if (it == end || *it == '/')
                  {
                        Path cwd(home());
                        _dirs = cwd._dirs;
                        _absolute = true;
                  }
                  else --it;
            }

            while (it != end)
            {
                  std::string name;
                  while (it != end && *it != '/') name += *it++;
                  if (it != end)
                  {
                        if (_dirs.empty())
                        {
                              if (!name.empty() && *(name.rbegin()) == ':')
                                    _device.assign(name, 0, name.length() - 1);
                              else
                                    pushDirectory(name);
                        }
                        else pushDirectory(name);
                  }
                  else _name = name;
                  if (it != end) ++it;
            }
      }
}


Generated by  Doxygen 1.6.0   Back to index