当前位置: 首页>>代码示例>>C++>>正文


C++ URI::path方法代码示例

本文整理汇总了C++中URI::path方法的典型用法代码示例。如果您正苦于以下问题:C++ URI::path方法的具体用法?C++ URI::path怎么用?C++ URI::path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在URI的用法示例。


在下文中一共展示了URI::path方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: call_dlopen

void* PosixDlopenLibLoader::call_dlopen(const URI& fpath)
{
  void* hdl = nullptr;

  hdl = dlopen (fpath.path().c_str(), RTLD_LAZY|RTLD_GLOBAL);

  if( is_not_null(hdl) )
    CFinfo << "dlopen() loaded library \'" << fpath.path() << "\'" << CFendl;

  // library name
  if ( is_null(hdl) && !fpath.is_absolute() )
  {

    // loop over the search paths and attempt to load the library

    std::vector< URI >::const_iterator itr = m_search_paths.begin();
    for ( ; itr != m_search_paths.end(); ++itr)
    {
//          CFinfo << "searching in [" << *itr << "]\n" << CFflush;
      URI fullqname = *itr / fpath;
//          CFinfo << "fullqname [" << fullqname.string() << "]\n" << CFflush;
      hdl = dlopen (fullqname.path().c_str(), RTLD_LAZY|RTLD_GLOBAL);
      if( hdl != nullptr )
      {
        CFinfo << "dlopen() loaded library \'" << fullqname.path() << "\'" << CFendl;
        break;
      }
    }
  }

  return hdl; // will return nullptr if failed
}
开发者ID:xyuan,项目名称:coolfluid3,代码行数:32,代码来源:PosixDlopenLibLoader.cpp

示例2: Failure

Future<Nothing> HadoopFetcherPlugin::fetch(
    const URI& uri,
    const string& directory)
{
  // TODO(jieyu): Validate the given URI.

  if (!uri.has_path()) {
    return Failure("URI path is not specified");
  }

  Try<Nothing> mkdir = os::mkdir(directory);
  if (mkdir.isError()) {
    return Failure(
        "Failed to create directory '" +
        directory + "': " + mkdir.error());
  }

  // NOTE: We ignore the scheme prefix if the host in URI is not
  // specified. This is the case when the host is set using the hadoop
  // configuration file.
  //
  // TODO(jieyu): Allow user to specify the name of the output file.
  return hdfs.get()->copyToLocal(
      (uri.has_host() ? stringify(uri) : uri.path()),
      path::join(directory, Path(uri.path()).basename()));
}
开发者ID:447327642,项目名称:mesos,代码行数:26,代码来源:hadoop.cpp

示例3: icase_equal

bool operator == (const URI& lhs, const URI& rhs) noexcept {
  return icase_equal(lhs.scheme(), rhs.scheme())
         and (lhs.userinfo() == rhs.userinfo())
         and icase_equal(lhs.host(), rhs.host())
         and lhs.port() == rhs.port()
         and lhs.path() == rhs.path()
         and lhs.query() == rhs.query()
         and lhs.fragment() == rhs.fragment();
}
开发者ID:AnnikaH,项目名称:IncludeOS,代码行数:9,代码来源:uri.cpp

示例4: trigger_file

void BinaryDataReader::trigger_file()
{
  const URI file_uri = options().value<URI>("file");
  if(!boost::filesystem::exists(file_uri.path()))
  {
    throw SetupError(FromHere(), "Input file " + file_uri.path() + " does not exist");
  }
  m_implementation.reset(new Implementation(file_uri, options().value<Uint>("rank")));
}
开发者ID:BijanZarif,项目名称:coolfluid3,代码行数:9,代码来源:BinaryDataReader.cpp

示例5: populate_from_url

  void Client::populate_from_url(Request& req, const URI& url)
  {
    // Set uri path (default "/")
    req.set_uri((!url.path().empty()) ? URI{url.path()} : URI{"/"});

    // Set Host: host(:port)
    const auto port = url.port();
    req.header().set_field(header::Host,
      (port != 0xFFFF and port != 80) ?
      url.host().to_string() + ":" + std::to_string(port)
      : url.host().to_string()); // to_string madness
  }
开发者ID:,项目名称:,代码行数:12,代码来源:

示例6: build_filename

 std::string build_filename(const URI& input, const Uint rank)
 {
   const URI my_dir = input.base_path();
   const std::string basename = input.base_name();
   const URI result(my_dir / (basename + "_P" + to_str(rank) + ".cfbin"));
   return result.path();
 }
开发者ID:BijanZarif,项目名称:coolfluid3,代码行数:7,代码来源:BinaryDataWriter.cpp

示例7: Failure

Future<Nothing> CurlFetcherPlugin::fetch(
    const URI& uri,
    const string& directory)
{
  // TODO(jieyu): Validate the given URI.

  if (!uri.has_path()) {
    return Failure("URI path is not specified");
  }

  if (!os::exists(directory)) {
    Try<Nothing> mkdir = os::mkdir(directory);
    if (mkdir.isError()) {
      return Failure(
          "Failed to create directory '" +
          directory + "': " + mkdir.error());
    }
  }

  // TODO(jieyu): Allow user to specify the name of the output file.
  const string output = path::join(directory, Path(uri.path()).basename());

  const vector<string> argv = {
    "curl",
    "-s",                 // Don’t show progress meter or error messages.
    "-S",                 // Makes curl show an error message if it fails.
    "-L",                 // Follow HTTP 3xx redirects.
    "-w", "%{http_code}", // Display HTTP response code on stdout.
    "-o", output,         // Write output to the file.
    strings::trim(stringify(uri))
  };

  Try<Subprocess> s = subprocess(
      "curl",
      argv,
      Subprocess::PATH("/dev/null"),
      Subprocess::PIPE(),
      Subprocess::PIPE());

  if (s.isError()) {
    return Failure("Failed to exec the curl subprocess: " + s.error());
  }

  return await(
      s.get().status(),
      io::read(s.get().out().get()),
      io::read(s.get().err().get()))
    .then(_fetch);
}
开发者ID:juanramb,项目名称:mesos,代码行数:49,代码来源:curl.cpp

示例8: download

// TODO(jieyu): Add a comment here.
static Future<int> download(
    const URI& uri,
    const string& directory,
    const http::Headers& headers = http::Headers())
{
  const string output = path::join(directory, Path(uri.path()).basename());

  vector<string> argv = {
    "curl",
    "-s",                 // Don't show progress meter or error messages.
    "-S",                 // Make curl show an error message if it fails.
    "-L",                 // Follow HTTP 3xx redirects.
    "-w", "%{http_code}", // Display HTTP response code on stdout.
    "-o", output          // Write output to the file.
  };

  // Add additional headers.
  foreachpair (const string& key, const string& value, headers) {
    argv.push_back("-H");
    argv.push_back(key + ": " + value);
  }
开发者ID:davelester,项目名称:mesos,代码行数:22,代码来源:docker.cpp

示例9:

std::size_t URI::HashFn::operator()(const URI& uri) const
{
    std::size_t seed = 0;

    if (uri.scheme()) {
        boost::hash_combine(seed, *uri.scheme());
    }

    if (uri.authority()) {
        boost::hash_combine(seed, *uri.authority());
    }

    boost::hash_combine(seed, uri.path());

    if (uri.query()) {
        boost::hash_combine(seed, *uri.query());
    }

    if (uri.fragment()) {
        boost::hash_combine(seed, *uri.fragment());
    }

    return seed;
}
开发者ID:isaach1000,项目名称:json-schema,代码行数:24,代码来源:uri.cpp

示例10: Failure

Future<Nothing> CurlFetcherPlugin::fetch(
    const URI& uri,
    const string& directory)
{
  // TODO(jieyu): Validate the given URI.

  if (!uri.has_path()) {
    return Failure("URI path is not specified");
  }

  Try<Nothing> mkdir = os::mkdir(directory);
  if (mkdir.isError()) {
    return Failure(
        "Failed to create directory '" +
        directory + "': " + mkdir.error());
  }

  // TODO(jieyu): Allow user to specify the name of the output file.
  const string output = path::join(directory, Path(uri.path()).basename());

  const vector<string> argv = {
    "curl",
    "-s",                 // Don’t show progress meter or error messages.
    "-S",                 // Makes curl show an error message if it fails.
    "-L",                 // Follow HTTP 3xx redirects.
    "-w", "%{http_code}", // Display HTTP response code on stdout.
    "-o", output,         // Write output to the file.
    strings::trim(stringify(uri))
  };

  Try<Subprocess> s = subprocess(
      "curl",
      argv,
      Subprocess::PATH("/dev/null"),
      Subprocess::PIPE(),
      Subprocess::PIPE());

  if (s.isError()) {
    return Failure("Failed to exec the curl subprocess: " + s.error());
  }

  return await(
      s.get().status(),
      io::read(s.get().out().get()),
      io::read(s.get().err().get()))
    .then([](const tuple<
        Future<Option<int>>,
        Future<string>,
        Future<string>>& t) -> Future<Nothing> {
      Future<Option<int>> status = std::get<0>(t);
      if (!status.isReady()) {
        return Failure(
            "Failed to get the exit status of the curl subprocess: " +
            (status.isFailed() ? status.failure() : "discarded"));
      }

      if (status->isNone()) {
        return Failure("Failed to reap the curl subprocess");
      }

      if (status->get() != 0) {
        Future<string> error = std::get<2>(t);
        if (!error.isReady()) {
          return Failure(
              "Failed to perform 'curl'. Reading stderr failed: " +
              (error.isFailed() ? error.failure() : "discarded"));
        }

        return Failure("Failed to perform 'curl': " + error.get());
      }

      Future<string> output = std::get<1>(t);
      if (!output.isReady()) {
        return Failure(
            "Failed to read stdout from 'curl': " +
            (output.isFailed() ? output.failure() : "discarded"));
      }

      // Parse the output and get the HTTP response code.
      Try<int> code = numify<int>(output.get());
      if (code.isError()) {
        return Failure("Unexpected output from 'curl': " + output.get());
      }

      if (code.get() != http::Status::OK) {
        return Failure(
            "Unexpected HTTP response code: " +
            http::Status::string(code.get()));
      }

      return Nothing();
    });
}
开发者ID:447327642,项目名称:mesos,代码行数:93,代码来源:curl.cpp

示例11: unlink

bool VFSFile::unlink( const URI &uri )
{
   int32 err = 0;
   return Sys::fal_unlink( uri.path(), err );
}
开发者ID:IamusNavarathna,项目名称:lv3proj,代码行数:5,代码来源:vfs_file_win.cpp

示例12: move

bool VFSFile::move( const URI &suri, const URI &duri )
{
   int32 err = 0;
   return Sys::fal_move( suri.path(), duri.path(), err );
}
开发者ID:IamusNavarathna,项目名称:lv3proj,代码行数:5,代码来源:vfs_file_win.cpp

示例13: rmdir

bool VFSFile::rmdir( const URI &uri )
{
   AutoCString filename( uri.path() );
   return ::rmdir( filename.c_str() ) == 0;
}
开发者ID:IamusNavarathna,项目名称:lv3proj,代码行数:5,代码来源:vfs_file_unix.cpp

示例14: mkdir

bool VFSFile::mkdir( const URI &uri, uint32 mode )
{
   AutoCString filename( uri.path() );
   return ::mkdir( filename.c_str(), mode ) == 0;
}
开发者ID:IamusNavarathna,项目名称:lv3proj,代码行数:5,代码来源:vfs_file_unix.cpp

示例15: move

bool VFSFile::move( const URI &suri, const URI &duri )
{
   AutoCString filename( suri.path() );
   AutoCString dest( duri.path() );
   return ::rename( filename.c_str(), dest.c_str() ) == 0;
}
开发者ID:IamusNavarathna,项目名称:lv3proj,代码行数:6,代码来源:vfs_file_unix.cpp


注:本文中的URI::path方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。