本文整理汇总了C++中std::istream::close方法的典型用法代码示例。如果您正苦于以下问题:C++ istream::close方法的具体用法?C++ istream::close怎么用?C++ istream::close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::istream
的用法示例。
在下文中一共展示了istream::close方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
void run(std::istream& in)
{
vector<string> tokens;
string line;
while(getline(in,line,'\n'))
{
if(AbstractApplication::stopping()) break;
if(line.empty()) continue;
if(line[0]=='#')
{
if(line.size()>1 && line[1]=='#')
{
cout << line << endl;
continue;
}
cout << line << tokenizer.delim
<< "uniprot.beg" << tokenizer.delim
<< "uniprot.end" << tokenizer.delim
<< "uniprot.type" << tokenizer.delim
<< "uniprot.status" << tokenizer.delim
<< "uniprot.desc" << tokenizer.delim
<< "uniprot.evidence" << tokenizer.delim
<< "uniprot.ref"
<< endl;
continue;
}
tokenizer.split(line,tokens);
if(column_aa_pos>=(int)tokens.size())
{
cerr << "Out of range for COLUMN_AA in " << line << endl;
continue;
}
if(column_spId>=(int)tokens.size())
{
cerr << "Out of range for SWISSPROT-ID in " << line << endl;
continue;
}
string swissprotId=tokens[column_spId];
if(swissprotId.empty() || swissprotId.compare(".")==0)
{
cout << line;
for(int i=0; i< 7; ++i) cout << tokenizer.delim << ".";
cout << endl;
continue;
}
char* p2;
int posAA= (int)strtol(tokens[column_aa_pos].c_str(),&p2,10);
if(*p2!=0 || posAA<1)
{
cerr << "Bad Column-aa in " << line << endl;
continue;
}
if(!(current_recordid.compare(swissprotId)==0 && record!=NULL))
{
if(record!=NULL) ::xmlFreeDoc(record);
record=NULL;
ostringstream urlos;
urlos << "http://www.uniprot.org/uniprot/" << swissprotId << ".xml";
string url(urlos.str());
netstreambuf in;
in.open(url.c_str());
string xml=in.content();
in.close();
int options=XML_PARSE_NOERROR|XML_PARSE_NONET;
record=xmlReadMemory(xml.c_str(),xml.size(),
url.c_str(),
NULL,
options);
if(record==NULL)
{
cerr << "#warning: Cannot find record for "<< swissprotId << endl;
cout << line ;
for(int i=0; i< 7; ++i) cout << tokenizer.delim << ".";
cout << endl;
continue;
}
current_recordid.assign(swissprotId);
}
bool found=false;
xmlNodePtr uniprot=xmlDocGetRootElement(record);
xmlNodePtr entry=first(uniprot,"entry");
if(entry!=NULL)
{
for(xmlNodePtr feature = entry->children; feature!=NULL; feature = feature->next)
{
if (feature->type != XML_ELEMENT_NODE) continue;
if(!::xmlStrEqual(feature->name,BAD_CAST "feature"))
{
continue;
}
bool match=false;
xmlNodePtr location=first(feature,"location");
if(location==NULL) continue;
//.........这里部分代码省略.........