本文整理汇总了C++中Paths::front方法的典型用法代码示例。如果您正苦于以下问题:C++ Paths::front方法的具体用法?C++ Paths::front怎么用?C++ Paths::front使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Paths
的用法示例。
在下文中一共展示了Paths::front方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: infer
void Kernel::infer(std::vector<std::string> args)
{
if (args.empty())
{
std::cout << getUsageString() << std::flush;
return;
}
if (args.size() == 1)
{
if (args[0] == "help" || args[0] == "-h" || args[0] == "--help")
{
std::cout << getUsageString() << std::flush;
return;
}
}
// TODO Allow multiple.
Paths paths;
std::size_t threads(4);
Json::Value jsonReprojection;
std::string user;
std::string tmpPath("tmp");
bool trustHeaders(true);
std::string output;
std::size_t a(0);
while (a < args.size())
{
const std::string arg(args[a]);
if (arg.front() != '-')
{
// If this is not an option argument, use it as the path.
if (paths.empty())
{
paths.push_back(arg);
}
else
{
throw std::runtime_error(
"Only one path allowed - found both '" +
paths.front() + "' and '" + arg + "'");
}
}
else if (arg == "-a")
{
if (++a < args.size())
{
tmpPath = args[a];
}
else
{
throw std::runtime_error("Invalid tmp specification");
}
}
else if (arg == "-o")
{
if (++a < args.size())
{
output = args[a] + ".entwine-inference";
}
else
{
throw std::runtime_error("Invalid output specification");
}
}
else if (arg == "-r")
{
if (++a < args.size())
{
const bool onlyOutput(
a + 1 >= args.size() ||
args[a + 1].front() == '-');
if (onlyOutput)
{
jsonReprojection["out"] = args[a];
}
else
{
jsonReprojection["in"] = args[a];
jsonReprojection["out"] = args[++a];
}
}
else
{
throw std::runtime_error("Invalid reprojection argument");
}
}
else if (arg == "-h")
{
jsonReprojection["hammer"] = true;
}
else if (arg == "-x")
{
trustHeaders = false;
//.........这里部分代码省略.........
示例2: full_path
int
main( int argc, char** argv)
{
fs::path full_path( fs::initial_path<fs::path>() );
if ( argc > 1 )
full_path = fs::system_complete( fs::path( argv[1], fs::native ) );
else
PrintUsage();
// specification of hi, low date of studies
if( argc > 2)
{
string s(argv[2]);
if( s.compare( "--info") == 0 )
{
entryCont.infoOnly = true;
}
else
{
if( argc > 3)
{
entryCont.dateFrom = argv[2];
entryCont.dateTo = argv[3];
}
else
PrintUsage();
}
}
// recursively (through queue) go through all files in subtree
// of specified directory specified
try {
if ( fs::is_directory( full_path ) )
{
paths.push( full_path);
}
else // must be a file
{
entryCont.SolveFile( full_path.string(), "buddy" );
}
fs::path currPath;
while( ! paths.empty() )
{
currPath = paths.front();
SolveDir( currPath);
paths.pop(); // remove this dir from queue
}
} catch( std::exception &ex) {
LOG( ex.what());
}
// flush info
{
ofstream o("output.txt");
entryCont.FlushMaps( o);
o.close();
}
return 0;
}