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


C++ Klass::genCppNameSpaceInclusionPath方法代码示例

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


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

示例1: generateRdfTypeInfo

void generateRdfTypeInfo(const ontology::Ontology& ontology) {
    std::ofstream oifs;
    createFile(RdfsEntity::outdir + "/RdfTypeInfo.h", &oifs);
    startInternal(oifs);
    generateCodeProtectorBegin(oifs, "", "RdfTypeInfo");
    oifs << "class RdfTypeInfo {" << std::endl;
    oifs << "public:" << std::endl;
    indent(oifs, 1) << "RdfTypeInfo();" << std::endl;
    oifs << std::endl;
    indent(oifs, 1) << "static const std::map<std::string, std::set<std::string> >& data() { return DATA; }" << std::endl;
    oifs << "private:" << std::endl;
    indent(oifs, 1) << "static std::map<std::string, std::set<std::string> > DATA;" << std::endl;
    oifs << "};" << std::endl;
    oifs << std::endl;
    generateCodeProtectorEnd(oifs, "", "RdfTypeInfo");
    stopInternal(oifs);

    std::ofstream ofs;
    createFile(RdfsEntity::outdir + "/RdfTypeInfo.cpp", &ofs);
    startInternal(ofs);
    addBoilerPlate(ofs);
    ofs << std::endl;
    ofs << "#include <map>" << std::endl;
    ofs << "#include <set>" << std::endl;
    ofs << "#include <string>" << std::endl;
    ofs << std::endl;
    if ( RdfsEntity::outdir == ".") {
        ofs << "#include \"RdfTypeInfo.h\"" << std::endl;
    } else {
        ofs << "#include \"" << RdfsEntity::outdir << "/RdfTypeInfo.h\"" << std::endl;
    }
    ofs << std::endl;
    for ( auto const& klassMapItem: ontology.classUri2Ptr()) {
        const Klass cls(*klassMapItem.second);
        ofs << "#include \"" << cls.genCppNameSpaceInclusionPath() << "/" << klassMapItem.second->prettyIRIName() << ".h" << "\"" << std::endl;
    }
    ofs << std::endl;

    ofs << "std::map<std::string, std::set<std::string> > RdfTypeInfo::DATA;" << std::endl;
    ofs << std::endl;
    ofs << "RdfTypeInfo::RdfTypeInfo() {" << std::endl;
    indent(ofs, 1) << "if ( DATA.empty() ) {" << std::endl;
    for ( auto const& klassMapItem: ontology.classUri2Ptr()) {
        const Klass& cls = *klassMapItem.second;
        indent(ofs, 2) << "DATA[\"" << klassMapItem.first << "\"] = " << cls.genCppNameSpaceFullyQualified() << "::" <<
                klassMapItem.second->prettyIRIName() << "::ancestorsRdfTypeIRI();" << std::endl;
    }
    indent(ofs, 1) << "};" << std::endl;
    ofs << std::endl;
    ofs << "}" << std::endl;
    ofs << std::endl;
    ofs << "namespace {" << std::endl;
    ofs << "RdfTypeInfo __loader;" << std::endl;
    ofs << "}" << std::endl;
    stopInternal(ofs);
}
开发者ID:airballking,项目名称:AutoRDF,代码行数:56,代码来源:main.cpp


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