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


C++ CDir::GetPath方法代码示例

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


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

示例1: sUpdateCase

void sUpdateCase(CDir& test_cases_dir, const string& test_name)
{   
    string input = CDir::ConcatPath( test_cases_dir.GetPath(), test_name + "." + extInput);
    string output = CDir::ConcatPath( test_cases_dir.GetPath(), test_name + "." + extOutput);
    string errors = CDir::ConcatPath( test_cases_dir.GetPath(), test_name + "." + extErrors);
    if (!CFile(input).Exists()) {
         BOOST_FAIL("input file " << input << " does not exist.");
    }
    cerr << "Creating new test case from " << input << " ..." << endl;

    CErrorLogger logger(errors);
    CGvfReader reader(0);
    CNcbiIfstream ifstr(input.c_str());

    typedef CGff2Reader::TAnnotList ANNOTS;
    ANNOTS annots;
    try {
        reader.ReadSeqAnnots(annots, ifstr, &logger);
    }
    catch (...) {
        ifstr.close();
        BOOST_FAIL("Error: " << input << " failed during conversion.");
    }
    ifstr.close();
    cerr << "    Produced new error listing " << output << "." << endl;

    CNcbiOfstream ofstr(output.c_str());
    for (ANNOTS::iterator cit = annots.begin(); cit != annots.end(); ++cit){
        ofstr << MSerial_AsnText << **cit;
        ofstr.flush();
    }
    ofstr.close();
    cerr << "    Produced new ASN1 file " << output << "." << endl;

    cerr << " ... Done." << endl;
}
开发者ID:svn2github,项目名称:ncbi_tk,代码行数:36,代码来源:unit_test_gvfreader.cpp

示例2: sUpdateCase

void sUpdateCase(CDir& test_cases_dir, const string& test_name)
{   
    string input = CDir::ConcatPath( test_cases_dir.GetPath(), test_name + "." + extInput);
    string output = CDir::ConcatPath( test_cases_dir.GetPath(), test_name + "." + extOutput);
    string errors = CDir::ConcatPath( test_cases_dir.GetPath(), test_name + "." + extErrors);
    if (!CFile(input).Exists()) {
         BOOST_FAIL("input file " << input << " does not exist.");
    }
    string test_base, test_type;
    NStr::SplitInTwo(test_name, ".", test_base, test_type);
    cerr << "Creating new test case from " << input << " ..." << endl;

    CErrorLogger logger(errors);

    //get a scope
    CRef<CObjectManager> pObjMngr = CObjectManager::GetInstance();
    CGBDataLoader::RegisterInObjectManager(*pObjMngr);
    CRef<CScope> pScope(new CScope(*pObjMngr));
    pScope->AddDefaults();

    //get a writer object
    CNcbiIfstream ifstr(input.c_str(), ios::binary);
    CObjectIStream* pI = CObjectIStream::Open(eSerial_AsnText, ifstr, eTakeOwnership);

    CNcbiOfstream ofstr(output.c_str());
    CBedGraphWriter* pWriter = sGetWriter(*pScope, ofstr);

    if (test_type == "annot") {
        CRef<CSeq_annot> pAnnot(new CSeq_annot);
        *pI >> *pAnnot;
        pWriter->WriteHeader();
        pWriter->WriteAnnot(*pAnnot);
        pWriter->WriteFooter();
        delete pWriter;
        ofstr.flush();
    }
开发者ID:svn2github,项目名称:ncbi_tk,代码行数:36,代码来源:unit_test_bedgraphwriter.cpp


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