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


C++ Reference::GetUnsignedMap方法代码示例

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


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

示例1: getContents

Py::Object ParameterGrpPy::getContents(const Py::Tuple& args)
{
    if (!PyArg_ParseTuple(args.ptr(), ""))
        throw Py::Exception();

    if (_cParamGrp->IsEmpty())
        return Py::None();

    Py::List list;
    // filling up Text nodes
    std::vector<std::pair<std::string,std::string> > mcTextMap = _cParamGrp->GetASCIIMap();
    for (std::vector<std::pair<std::string,std::string> >::iterator It2=mcTextMap.begin();It2!=mcTextMap.end();++It2) {
        Py::Tuple t2(3);
        t2.setItem(0,Py::String("String"));
        t2.setItem(1,Py::String(It2->first.c_str()));
        t2.setItem(2,Py::String(It2->second.c_str()));
        list.append(t2);
    }

    // filling up Int nodes
    std::vector<std::pair<std::string,long> > mcIntMap = _cParamGrp->GetIntMap();
    for (std::vector<std::pair<std::string,long> >::iterator It3=mcIntMap.begin();It3!=mcIntMap.end();++It3) {
        Py::Tuple t3(3);
        t3.setItem(0,Py::String("Integer"));
        t3.setItem(1,Py::String(It3->first.c_str()));
#if PY_MAJOR_VERSION < 3
        t3.setItem(2,Py::Int(It3->second));
#else
        t3.setItem(2,Py::Long(It3->second));
#endif
        list.append(t3);
    }

    // filling up Float nodes
    std::vector<std::pair<std::string,double> > mcFloatMap = _cParamGrp->GetFloatMap();
    for (std::vector<std::pair<std::string,double> >::iterator It4=mcFloatMap.begin();It4!=mcFloatMap.end();++It4) {
        Py::Tuple t4(3);
        t4.setItem(0,Py::String("Float"));
        t4.setItem(1,Py::String(It4->first.c_str()));
        t4.setItem(2,Py::Float(It4->second));
        list.append(t4);
    }

    // filling up bool nodes
    std::vector<std::pair<std::string,bool> > mcBoolMap = _cParamGrp->GetBoolMap();
    for (std::vector<std::pair<std::string,bool> >::iterator It5=mcBoolMap.begin();It5!=mcBoolMap.end();++It5) {
        Py::Tuple t5(3);
        t5.setItem(0,Py::String("Boolean"));
        t5.setItem(1,Py::String(It5->first.c_str()));
        t5.setItem(2,Py::Boolean(It5->second));
        list.append(t5);
    }

    // filling up UInt nodes
    std::vector<std::pair<std::string,unsigned long> > mcUIntMap = _cParamGrp->GetUnsignedMap();
    for (std::vector<std::pair<std::string,unsigned long> >::iterator It6=mcUIntMap.begin();It6!=mcUIntMap.end();++It6) {
        Py::Tuple t6(3);
        t6.setItem(0,Py::String("Unsigned Long"));
        t6.setItem(1,Py::String(It6->first.c_str()));
#if PY_MAJOR_VERSION < 3
        t6.setItem(2,Py::asObject(Py_BuildValue("I",It6->second)));
#else
        t6.setItem(2,Py::Long(It6->second));
#endif
        list.append(t6);
    }

    return list;
}
开发者ID:DeepSOIC,项目名称:FreeCAD-ellipse,代码行数:69,代码来源:ParameterPy.cpp


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