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


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

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


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

示例1: Error

// Returns the resulting file or in case of extraction the destination
// directory (for logging).
static Try<string> fetchBypassingCache(
    const CommandInfo::URI& uri,
    const string& sandboxDirectory,
    const Option<string>& frameworksHome)
{
  LOG(INFO) << "Fetching directly into the sandbox directory";

  Try<string> basename = Fetcher::basename(uri.value());
  if (basename.isError()) {
    return Error("Failed to determine the basename of the URI '" +
                 uri.value() + "' with error: " + basename.error());
  }

  string path = path::join(sandboxDirectory, basename.get());

  Try<string> downloaded = download(uri.value(), path, frameworksHome);
  if (downloaded.isError()) {
    return Error(downloaded.error());
  }

  if (uri.executable()) {
    return chmodExecutable(downloaded.get());
  } else if (uri.extract()) {
    Try<bool> extracted = extract(path, sandboxDirectory);
    if (extracted.isError()) {
      return Error(extracted.error());
    } else if (!extracted.get()) {
      LOG(WARNING) << "Copying instead of extracting resource from URI with "
                   << "'extract' flag, because it does not seem to be an "
                   << "archive: " << uri.value();
    }
  }

  return downloaded;
}
开发者ID:fin09pcap,项目名称:mesos,代码行数:37,代码来源:fetcher.cpp

示例2: Error

// Returns the resulting file or in case of extraction the destination
// directory (for logging).
static Try<string> fetchBypassingCache(
    const CommandInfo::URI& uri,
    const string& sandboxDirectory,
    const Option<string>& frameworksHome)
{
  LOG(INFO) << "Fetching directly into the sandbox directory";

  // TODO(mrbrowning): Factor out duplicated processing of "output_file" field
  // here and in fetchFromCache into a separate helper function.
  if (uri.has_output_file()) {
    string dirname = Path(uri.output_file()).dirname();
    if (dirname != ".") {
      Try<Nothing> result =
        os::mkdir(path::join(sandboxDirectory, dirname), true);

      if (result.isError()) {
        return Error(
            "Unable to create subdirectory " + dirname + " in sandbox");
      }
    }
  }

  Try<string> outputFile = uri.has_output_file()
    ? uri.output_file()
    : Fetcher::basename(uri.value());

  if (outputFile.isError()) {
    return Error(outputFile.error());
  }

  string path = path::join(sandboxDirectory, outputFile.get());

  Try<string> downloaded = download(uri.value(), path, frameworksHome);
  if (downloaded.isError()) {
    return Error(downloaded.error());
  }

  if (uri.executable()) {
    return chmodExecutable(downloaded.get());
  } else if (uri.extract()) {
    Try<bool> extracted = extract(path, sandboxDirectory);
    if (extracted.isError()) {
      return Error(extracted.error());
    } else if (!extracted.get()) {
      LOG(WARNING) << "Copying instead of extracting resource from URI with "
                   << "'extract' flag, because it does not seem to be an "
                   << "archive: " << uri.value();
    }
  }

  return downloaded;
}
开发者ID:BonnieTang,项目名称:mesos,代码行数:54,代码来源:fetcher.cpp

示例3:

inline std::size_t hash_value(const CommandInfo::URI& uri)
{
  size_t seed = 0;

  if (uri.extract()) {
    seed += 11;
  }

  if (uri.executable()) {
    seed += 2003;
  }

  boost::hash_combine(seed, uri.value());
  return seed;
}
开发者ID:GSidRam,项目名称:mesos,代码行数:15,代码来源:type_utils.hpp

示例4:

bool operator == (const CommandInfo::URI& left, const CommandInfo::URI& right)
{
    return left.value() == right.value() &&
           left.executable() == right.executable() &&
           left.extract() == right.extract();
}
开发者ID:lukeleslie,项目名称:mesos,代码行数:6,代码来源:type_utils.cpp


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