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


C++ TfTokenVector::resize方法代码示例

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


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

示例1: _MakeProperties

std::vector<UsdProperty>
UsdPrim::_GetPropertiesInNamespace(const std::string &namespaces,
                                   bool onlyAuthored) const
{
    // XXX Would be nice to someday plumb the prefix search down through pcp
    if (namespaces.empty())
        return onlyAuthored ? GetAuthoredProperties() : GetProperties();

    const char delim = UsdObject::GetNamespaceDelimiter();

    TfTokenVector names = _GetPropertyNames(onlyAuthored, /*applyOrder=*/false);

    // Set terminator to the expected position of the delimiter after all the
    // supplied namespaces.  We perform an explicit test for this char below
    // so that we don't need to allocate a new string if namespaces does not
    // already end with the delimiter
    const size_t terminator = namespaces.size() -
        (*namespaces.rbegin() == delim);

    // Prune out non-matches before we sort
    size_t insertionPt = 0;
    for (const auto& name : names) {
        const std::string &s = name.GetString();
        if (s.size() > terminator               &&
            TfStringStartsWith(s, namespaces)   && 
            s[terminator] == delim) {

            names[insertionPt++] = name;
        }
    }
    names.resize(insertionPt);
    sort(names.begin(), names.end(), TfDictionaryLessThan());
    _ApplyOrdering(GetPropertyOrder(), &names);
    return _MakeProperties(names);
}
开发者ID:lvxejay,项目名称:USD,代码行数:35,代码来源:prim.cpp


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