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


C++ ObjectType::typeTemplate方法代码示例

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


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

示例1: addParsersRecursive

void Module::addParsersRecursive(Object &object, const ObjectType &type, const Module &fromModule, const ObjectType &lastType) const
{
    //Building the father list
    std::list<ObjectType> fathers;
    ObjectType currentType = type;
    while(currentType.typeTemplate() != lastType.typeTemplate() && !currentType.isNull())
    {
        fathers.push_front(currentType);
        currentType = fromModule.getFather(currentType);
    }

    //Adding the fathers' parsers
    for(ObjectType father : fathers)
    {
        object.setType(father);
        const Module* module = handler(father);
        if(module!=nullptr)
        {
            Parser* parser = module->getParser(father, object, fromModule);
            object.addParser(parser);
        }
    }
    //Type specification
    ObjectType specification = specify(object.type());
    if(!specification.isNull())
    {
        addParsersRecursive(object, specification, fromModule, object.type());
    }
}
开发者ID:proudzhu,项目名称:hexamonkey,代码行数:29,代码来源:module.cpp

示例2: setSpecification

void Module::setSpecification(const ObjectType& parent, const ObjectType& child)
{
    if (!parent.typeTemplate().isVirtual()) {
        Log::error("Cannot forward ",parent," to ",child," because ",parent.typeTemplate(), " is not virtual ");
    }
    const ObjectType* parentPtr = new ObjectType(parent);
    _automaticSpecifications.insert(std::make_pair(parentPtr, child));
}
开发者ID:proudzhu,项目名称:hexamonkey,代码行数:8,代码来源:module.cpp

示例3: setSpecification

void Module::setSpecification(const ObjectType& parent, const ObjectType& child)
{
    if (!parent.typeTemplate().isVirtual()) {
        Log::error("Cannot forward ",parent," to ",child," because ",parent.typeTemplate().name(), " is not virtual ");
    }
    const ObjectType* parentPtr = new ObjectType(parent);
    _automaticSpecifications.insert(std::make_pair(parentPtr, child));

    auto it = _specializers.find(const_cast<ObjectTypeTemplate*>(&parent.typeTemplate()));
    if (it == _specializers.end()) {        
        _specializers.emplace(std::piecewise_construct, std::make_tuple(const_cast<ObjectTypeTemplate* >(&parent.typeTemplate())), std::make_tuple(parent, child));
    } else {
        it->second.forward(parent, child);
    }

}
开发者ID:,项目名称:,代码行数:16,代码来源:

示例4: specifyLocally

ObjectType Module::specifyLocally(const ObjectType& parent) const
{
    ObjectType type;
    ObjectType rangeBegin(parent.typeTemplate());
    for(SpecificationMap::const_iterator it = _automaticSpecifications.lower_bound(&rangeBegin);
        it != _automaticSpecifications.end() && it->first->typeTemplate() == parent.typeTemplate();
        ++it)
    {
        if(parent.extendsDirectly(*(it->first)))
        {
            type = it->second;
            type.importParameters(parent);
            break;
        }
    }
    return type;
}
开发者ID:proudzhu,项目名称:hexamonkey,代码行数:17,代码来源:module.cpp

示例5: addParsers

void Module::addParsers(Object &object, const ObjectType &type) const
{
    //Building the father list

    ObjectType currentType = type;
    ObjectType lastType;
    while (!currentType.isNull()) {
        std::list<ObjectType> fathers;
        while(currentType.typeTemplate() != lastType.typeTemplate() && !currentType.isNull())
        {
            fathers.push_front(currentType);
            currentType = currentType.parent();
        }

        //Adding the fathers' parsers
        for(ObjectType father : fathers)
        {
            object.setType(father);
            Parser* parser = father.parseOrGetParser(static_cast<ParsingOption&>(object));
            object.addParser(parser);
        }
        //Type specification
        lastType= object.type();
        currentType = specify(lastType);
    }

    const auto& parsers = object._parsers;
    if (std::any_of(parsers.begin(), parsers.end(), [](const std::unique_ptr<Parser>& parser) {
        if (parser) {
            return parser->needTailParsing();
        } else {
            return false;
        }
    })) {
        object.parse();
    };
}
开发者ID:,项目名称:,代码行数:37,代码来源:

示例6: specifyLocally

ObjectType Module::specifyLocally(const ObjectType& parent) const
{
    auto it = _specializers.find(const_cast<ObjectTypeTemplate*>(&parent.typeTemplate()));
    if (it == _specializers.end())
    {
        return ObjectType();
    }

    ObjectType type = it->second.specialize(parent);
    if (!type.isNull())
    {
        type.importParameters(parent);
    }

    return type;
}
开发者ID:,项目名称:,代码行数:16,代码来源:

示例7: specify

ObjectType Module::specify(const ObjectType &parent) const
{
    if (!parent.typeTemplate().isVirtual()) {
       return ObjectType();
    }

    ObjectType child = specifyLocally(parent);
    if(child.isNull())
    {
        for(const Module* importedModule : _importedModulesChain)
        {
            child = importedModule->specifyLocally(parent);
            if(!child.isNull())
                break;
        }
    }
    return child;
}
开发者ID:,项目名称:,代码行数:18,代码来源:

示例8: getFather

ObjectType Module::getFather(const ObjectType &child) const
{
    //Searching locally
    auto it = _extensions.find(&child.typeTemplate());
    if(it != _extensions.end())
    {
        ObjectType father = (it->second)(child);
        if(!father.isNull())
        {
            return father;
        }
    }

    //Searching in imported modules
    for(const Module* module: reverse(_importedModules))
    {
        ObjectType father = module->getFather(child);
        if(!father.isNull())
        {
            return father;
        }
    }
    return ObjectType();
}
开发者ID:proudzhu,项目名称:hexamonkey,代码行数:24,代码来源:module.cpp


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