本文整理汇总了C++中StringTokenizer::hasMoreToken方法的典型用法代码示例。如果您正苦于以下问题:C++ StringTokenizer::hasMoreToken方法的具体用法?C++ StringTokenizer::hasMoreToken怎么用?C++ StringTokenizer::hasMoreToken使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringTokenizer
的用法示例。
在下文中一共展示了StringTokenizer::hasMoreToken方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StringTokenizer
vector<int> NumCalcApplicationTools::seqFromString(const string & s, const string & delim, const string & seqdelim)
{
vector<int> seq;
StringTokenizer * st = new StringTokenizer(s, delim, true);
while (st->hasMoreToken())
{
StringTokenizer * st2 = new StringTokenizer(st->nextToken(), seqdelim, true);
if (st2->numberOfRemainingTokens() > 1)
{
vector<int> tmp = VectorTools::seq(TextTools::toInt(st2->getToken(0)), TextTools::toInt(st2->getToken(1)), 1);
VectorTools::append(seq, tmp);
}
else
{
seq.push_back(TextTools::toInt(st2->getToken(0)));
}
}
return seq;
}
示例2: main
int main(int args, char ** argv)
{
cout << "******************************************************************" << endl;
cout << "* Bio++ ReRoot, version 2.2.0 *" << endl;
cout << "* Author: C. Scornavacca Created 15/01/08 *" << endl;
cout << "* Last Modif. 25/09/14 *" << endl;
cout << "******************************************************************" << endl;
cout << endl;
if(args == 1)
{
help();
return 0;
}
try {
BppApplication bppreroot(args, argv, "BppReRoot");
bppreroot.startTimer();
Newick newick;
string listPath = ApplicationTools::getAFilePath("input.list.file", bppreroot.getParams());
ApplicationTools::displayResult("Input list file", listPath);
if(listPath == "none") throw Exception("You must provide an input tree list file.");
string outgroupsPath = ApplicationTools::getAFilePath("outgroups.file", bppreroot.getParams());
ApplicationTools::displayResult("Outgroups file", outgroupsPath);
if(outgroupsPath == "none") throw Exception("You must provide an outgroup list file.");
string outputPath = ApplicationTools::getAFilePath("output.trees.file", bppreroot.getParams(), true, false);
ApplicationTools::displayResult("Output file", outputPath);
if(outputPath == "none") throw Exception("You must provide an output file.");
bool printOption = ApplicationTools::getBooleanParameter("print.option", bppreroot.getParams(), false);
bool tryAgain = ApplicationTools::getBooleanParameter("tryAgain.option", bppreroot.getParams(), true);
vector<Tree*> tempTrees;
vector<MyTree*> trees;
//ApplicationTools::displayResult("Number of trees found", TextTools::toString(trees.size()));
const string path = outgroupsPath;
ifstream file(path.c_str(), ios::in);
string temp, description, taxon;
vector < vector<string> > levelOutgroup;
//Reading outgroup levels
while (!file.eof())
{
vector <string> tempTaxa;
getline(file, temp, '\n');
StringTokenizer line = StringTokenizer(temp, " ,");
while (line.hasMoreToken())
{
tempTaxa.push_back(line.nextToken());
}
levelOutgroup.push_back(tempTaxa);
}
file.close();
const string path2 = listPath;
ifstream treePath(path2.c_str(), ios::in);
if (!treePath) {
throw IOException ("Newick::read: failed to read from stream");
}
string temp2, description2;// Initialization
string::size_type index;
int k = 0;
while (!treePath.eof())
{
k++;
bool printOrNot =true;
Tree * tempTree = NULL;
getline(treePath, temp2, '\n'); // Copy current line in temporary string
index = temp2.find(";");
if (temp2 != "")
{
if (index != string::npos)
{
description2 += temp2.substr(0, index + 1);
tempTree = TreeTemplateTools::parenthesisToTree(description2);
description2 = temp2.substr(index + 1);
}
else description2 += temp;
MyTree* tree = dynamic_cast <MyTree* >(tempTree);
//ApplicationTools::displayGauge(tr, trees.size() - 1, '=');
vector<string> leavesTree;
leavesTree = (*tree).getLeavesNames();
size_t numNodes = tree->getNumberOfNodes() - 1;
//.........这里部分代码省略.........