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


C++ StringTable::getId方法代码示例

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


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

示例1: if

    StyleProviderImpl(const StyleSheet& stylesheet, StringTable& stringTable) :
        stringTable(stringTable),
        filters(),
        gradients()
    {
        filters.nodes.reserve(24);
        filters.ways.reserve(24);
        filters.areas.reserve(24);
        filters.relations.reserve(24);
        filters.canvases.reserve(24);

        for (const Rule& rule : stylesheet.rules) {
            for (const Selector& selector : rule.selectors) {
                for (const std::string& name : selector.names) {
                    FilterMap* filtersPtr = nullptr;
                    if (name == "node") filtersPtr = &filters.nodes;
                    else if (name == "way") filtersPtr = &filters.ways;
                    else if (name == "area") filtersPtr = &filters.areas;
                    else if (name == "relation") filtersPtr = &filters.relations;
                    else if (name == "canvas") filtersPtr = &filters.canvases;
                    else
                        std::domain_error("Unexpected selector name:" + name);

                    Filter filter = Filter();
                    filter.conditions.reserve(selector.conditions.size());
                    for (const Condition& condition : selector.conditions) {
                        ConditionType c;
                        if (condition.operation == "") c.type = OpType::Exists;
                        else if (condition.operation == "=") c.type = OpType::Equals;
                        else if (condition.operation == "!=") c.type = OpType::NotEquals;
                        else
                            std::domain_error("Unexpected condition operation:" + condition.operation);

                        c.key = stringTable.getId(condition.key);
                        c.value = stringTable.getId(condition.value);
                        filter.conditions.push_back(c);
                    }

                    filter.declarations.reserve(rule.declarations.size());
                    for (auto i = 0; i < rule.declarations.size(); ++i) {
                        Declaration declaration = rule.declarations[i];
                        uint32_t key = stringTable.getId(declaration.key);

                        if (utymap::utils::GradientUtils::isGradient(declaration.value))
                            addGradient(declaration.value);

                        filter.declarations[key] = Style::value_type(new StyleDeclaration(key, declaration.value));
                    }

                    std::sort(filter.conditions.begin(), filter.conditions.end(),
                        [](const ConditionType& c1, const ConditionType& c2) { return c1.key > c2.key; });
                    for (int i = selector.zoom.start; i <= selector.zoom.end; ++i) {
                        (*filtersPtr)[i].push_back(filter);
                    }
                }
            }
        }
    }
开发者ID:koreldan,项目名称:utymap,代码行数:58,代码来源:StyleProvider.cpp

示例2: QuadKeyBuilderImpl

 QuadKeyBuilderImpl(GeoStore& geoStore, StringTable& stringTable) :
     geoStore_(geoStore),
     stringTable_(stringTable),
     builderKeyId_(stringTable.getId(BuilderKeyName)),
     builderFactory_()
 {
 }
开发者ID:gitter-badger,项目名称:utymap,代码行数:7,代码来源:QuadKeyBuilder.cpp

示例3:

ElementStore::ElementStore(StringTable& stringTable) :
    clipKeyId_(stringTable.getId(ClipKey)),
    skipKeyId_(stringTable.getId(SkipKey)),
    sizeKeyId_(stringTable.getId(SizeKey))
{
}
开发者ID:Euphe,项目名称:utymap,代码行数:6,代码来源:ElementStore.cpp


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