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

std::string Poco::Path::transcode ( const std::string &  path  )  [static]

Searches the file with the given name in the locations (paths) specified in pathList. The paths in pathList must be delimited by the platform's path separator (see pathSeparator()). A relative path may be given in name.

If the file is found in one of the locations, the complete path of the file is stored in the path given as argument and true is returned. Otherwise false is returned and the path argument remains unchanged.

Definition at line 991 of file Path.cpp.

References Poco::Buffer< T >::begin(), and Poco::Buffer< T >::size().

Referenced by Poco::Util::FilesystemConfiguration::getRaw(), Poco::Util::PropertyFileConfiguration::load(), Poco::Util::IniFileConfiguration::load(), Poco::FileStreamFactory::open(), Poco::Util::PropertyFileConfiguration::save(), Poco::Util::FilesystemConfiguration::setRaw(), and Poco::XML::DOMWriter::writeNode().

{
#if defined(_WIN32) && defined(POCO_WIN32_UTF8)
      std::wstring uniPath;
      UnicodeConverter::toUTF16(path, uniPath);
      DWORD len = WideCharToMultiByte(CP_ACP, WC_NO_BEST_FIT_CHARS, uniPath.c_str(), static_cast<int>(uniPath.length()), NULL, 0, NULL, NULL);
      if (len > 0)
      {
            Buffer<char> buffer(len);
            DWORD rc = WideCharToMultiByte(CP_ACP, WC_NO_BEST_FIT_CHARS, uniPath.c_str(), static_cast<int>(uniPath.length()), buffer.begin(), static_cast<int>(buffer.size()), NULL, NULL);
            if (rc)
            {
                  return std::string(buffer.begin(), buffer.size());
            }
      }
#endif
      return path;
}


Generated by  Doxygen 1.6.0   Back to index