本文整理汇总了C++中GetPot::enable_loop方法的典型用法代码示例。如果您正苦于以下问题:C++ GetPot::enable_loop方法的具体用法?C++ GetPot::enable_loop怎么用?C++ GetPot::enable_loop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GetPot
的用法示例。
在下文中一共展示了GetPot::enable_loop方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseConfig
//.........这里部分代码省略.........
log_=LogFile(config.follow("",2,"-l","--logfile"));
if(config.search(2,"-D","--defaultdists"))
{
for(uint i=0;i<retriever_.numberOfSuffices();++i)
{
retriever_.dist(i,distanceMaker_.getDefaultDistance(retriever_.featureType(i)));
retriever_.weight(i,1.0);
DBG(10) << "default dist[" << i << "]=" << retriever_.dist(i)->name() << endl;
}
}
config.init_multiple_occurrence(); // can have multiple distances
while(config.search(2,"-d","--dist"))
{
uint idx=config.follow(0,2,"-d","--dist");
string distname=config.next("basedist"); // default distance measure (dummy!)
retriever_.weight(idx,1.0); // set default weight for configured distances
retriever_.dist(idx,distanceMaker_.makeDistance(distname));
DBG(10) << "dist[" << idx << "]=" << retriever_.dist(idx)->name() << endl;
}
config.init_multiple_occurrence(); // can have multiple weights
while(config.search(2,"-w","--weight"))
{
uint idx=config.follow(0,2,"-w","--weight");
double w=config.next(1.0);
retriever_.weight(idx,w);
DBG(10) << "weight[" << idx << "]=" << w << endl;
}
retriever_.setScoring(config.follow("linear",2,"-C","--scoring"));
if(config.search(2,"-I","--interactor"))
{
retriever_.setInteractor(config.follow("",2,"-I","--interactor"));
}
config.enable_loop(); // enable returning to the beginning of command line (was disabled for multiplicity before)
if(config.search(2,"-S","--startAfterInit"))
{
startAfterInit_=config.follow("echo \"No program defined\"",2,"-S","--startAfterInit");
}
if(config.search(2,"-P","--proxy"))
{
proxyhost_=config.follow("localhost",2,"-P","--proxy");
proxyport_=config.next(12963);
DBG(10) << "Will notify proxy at " << proxyhost_ << ":"<<proxyport_ << " about my existence." << endl;
}
if(config.search(2,"-r","--results"))
{
retriever_.results(config.follow(9,2,"-r","--results"));
DBG(10) << "results=" << retriever_.results() << endl;
}
if(config.search(2,"-l","--log"))
{
logfile_=config.follow("log.txt",2,"-l","--log");
DBG(10) << "logfile="<< logfile_ << endl;
}
if(config.search(2,"-s","--server"))
{
port_=config.follow(12961,2,"-s","--server");
DBG(10) << "port="<< port_ << endl;
}
if(config.search(2,"-B","--batch"))
{
batchfile_=config.follow("batch",2,"-B","--batch");
DBG(10) << "batchfile="<< batchfile_ << endl;
}
if(config.search("--cache")) {
retriever_.setCache(config.follow("cache.sqlite3.db","--cache"));
}
if(config.search(2,"-e","--expansion"))
{
retriever_.extensions(config.follow(2,2,"-e","--expansion"));
DBG(10) << "expansions=" << config.follow(2,2,"-e","--expansion") << endl;
}
if(config.search(2,"-p","--password"))
{
password_=config.follow("",2,"-p","--password");
DBG(10) << "password necessary for changing settings: " << password_ << endl;
}
if(config.search(2,"-t","--type2bin"))
{
t2bpath=config.follow("",2,"-t","--type2bin");
DBG(10) << "type2bin-file has been reset to: " << t2bpath << endl;
}
}