本文整理汇总了C++中py::List类的典型用法代码示例。如果您正苦于以下问题:C++ List类的具体用法?C++ List怎么用?C++ List使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了List类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: getPropertiesList
Py::List PropertyContainerPy::getPropertiesList(void) const
{
Py::List ret;
std::map<std::string,Property*> Map;
getPropertyContainerPtr()->getPropertyMap(Map);
for (std::map<std::string,Property*>::const_iterator It=Map.begin();It!=Map.end();++It)
ret.append(Py::String(It->first));
return ret;
}
开发者ID:3DPrinterGuy,项目名称:FreeCAD,代码行数:12,代码来源:PropertyContainerPyImp.cpp
示例2: supportedTypes
PyObject* DocumentPy::supportedTypes(PyObject *args)
{
if (!PyArg_ParseTuple(args, "")) // convert args: Python->C
return NULL; // NULL triggers exception
std::vector<Base::Type> ary;
Base::Type::getAllDerivedFrom(App::DocumentObject::getClassTypeId(), ary);
Py::List res;
for (std::vector<Base::Type>::iterator it = ary.begin(); it != ary.end(); ++it)
res.append(Py::String(it->getName()));
return Py::new_reference_to(res);
}
开发者ID:Daedalus12,项目名称:FreeCAD_sf_master,代码行数:12,代码来源:DocumentPyImp.cpp
示例3: setA
void MatrixPy::setA(Py::List arg)
{
double mat[16];
this->getMatrixPtr()->getMatrix(mat);
int index=0;
for (Py::List::iterator it = arg.begin(); it != arg.end() && index < 16; ++it) {
mat[index++] = (double)Py::Float(*it);
}
this->getMatrixPtr()->setMatrix(mat);
}
开发者ID:msocorcim,项目名称:FreeCAD,代码行数:12,代码来源:MatrixPyImp.cpp
示例4: setCommands
void PathPy::setCommands(Py::List list)
{
getToolpathPtr()->clear();
for (Py::List::iterator it = list.begin(); it != list.end(); ++it) {
if (PyObject_TypeCheck((*it).ptr(), &(Path::CommandPy::Type))) {
Path::Command &cmd = *static_cast<Path::CommandPy*>((*it).ptr())->getCommandPtr();
getToolpathPtr()->addCommand(cmd);
} else {
throw Py::Exception("The list can only contain Path Commands");
}
}
}
开发者ID:mumme74,项目名称:FreeCAD,代码行数:12,代码来源:PathPyImp.cpp
示例5: getImplementedModes
Py::List AttachEnginePy::getImplementedModes(void) const
{
try {
Py::List ret;
AttachEngine &attacher = *(this->getAttachEnginePtr());
for(int imode = 0 ; imode < mmDummy_NumberOfModes ; imode++){
if(attacher.modeRefTypes[imode].size() > 0){
ret.append(Py::String(attacher.getModeName(eMapMode(imode))));
}
}
return ret;
} ATTACHERPY_STDCATCH_ATTR;
}
开发者ID:AjinkyaDahale,项目名称:FreeCAD,代码行数:13,代码来源:AttachEnginePyImp.cpp
示例6: getPointSelection
PyObject* MeshPy::getPointSelection(PyObject *args)
{
if (!PyArg_ParseTuple(args, ""))
return 0;
Py::List ary;
std::vector<unsigned long> points;
getMeshObjectPtr()->getPointsFromSelection(points);
for (std::vector<unsigned long>::const_iterator it = points.begin(); it != points.end(); ++it) {
ary.append(Py::Int((int)*it));
}
return Py::new_reference_to(ary);
}
开发者ID:msocorcim,项目名称:FreeCAD,代码行数:14,代码来源:MeshPyImp.cpp
示例7: sGetVersion
PyObject* Application::sGetVersion(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
{
if (!PyArg_ParseTuple(args, "")) // convert args: Python->C
return NULL; // NULL triggers exception
Py::List list;
const std::map<std::string, std::string>& cfg = Application::Config();
std::map<std::string, std::string>::const_iterator it;
it = cfg.find("BuildVersionMajor");
list.append(Py::String(it != cfg.end() ? it->second : ""));
it = cfg.find("BuildVersionMinor");
list.append(Py::String(it != cfg.end() ? it->second : ""));
it = cfg.find("BuildRevision");
list.append(Py::String(it != cfg.end() ? it->second : ""));
it = cfg.find("BuildRepositoryURL");
list.append(Py::String(it != cfg.end() ? it->second : ""));
it = cfg.find("BuildRevisionDate");
list.append(Py::String(it != cfg.end() ? it->second : ""));
it = cfg.find("BuildRevisionBranch");
if (it != cfg.end())
list.append(Py::String(it->second));
it = cfg.find("BuildRevisionHash");
if (it != cfg.end())
list.append(Py::String(it->second));
return Py::new_reference_to(list);
}
开发者ID:3DPrinterGuy,项目名称:FreeCAD,代码行数:34,代码来源:ApplicationPy.cpp
示例8: getSeparateComponents
PyObject* MeshPy::getSeparateComponents(PyObject *args)
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py::List meshesList;
std::vector<std::vector<unsigned long> > segs;
segs = getMeshObjectPtr()->getComponents();
for (unsigned int i=0; i<segs.size(); i++) {
MeshObject* mesh = getMeshObjectPtr()->meshFromSegment(segs[i]);
meshesList.append(Py::Object(new MeshPy(mesh),true));
}
return Py::new_reference_to(meshesList);
}
开发者ID:msocorcim,项目名称:FreeCAD,代码行数:14,代码来源:MeshPyImp.cpp
示例9: getInListRecursive
Py::List DocumentObjectPy::getInListRecursive(void) const
{
Py::List ret;
try {
std::vector<DocumentObject*> list = getDocumentObjectPtr()->getInListRecursive();
for (std::vector<DocumentObject*>::iterator It = list.begin(); It != list.end(); ++It)
ret.append(Py::Object((*It)->getPyObject(), true));
}
catch (const Base::Exception& e) {
throw Py::IndexError(e.what());
}
return ret;
}
开发者ID:SparkyCola,项目名称:FreeCAD,代码行数:15,代码来源:DocumentObjectPyImp.cpp
示例10: getVKnotSequence
Py::List BSplineSurfacePy::getVKnotSequence(void) const
{
Handle_Geom_BSplineSurface surf = Handle_Geom_BSplineSurface::DownCast
(getGeometryPtr()->handle());
Standard_Integer m = 0;
for (int i=1; i<= surf->NbVKnots(); i++)
m += surf->VMultiplicity(i);
TColStd_Array1OfReal k(1,m);
surf->VKnotSequence(k);
Py::List list;
for (Standard_Integer i=k.Lower(); i<=k.Upper(); i++) {
list.append(Py::Float(k(i)));
}
return list;
}
开发者ID:Didier94,项目名称:FreeCAD_sf_master,代码行数:15,代码来源:BSplineSurfacePyImp.cpp
示例11: generated
PyObject* BRepOffsetAPI_MakePipeShellPy::generated(PyObject *args)
{
PyObject *shape;
if (!PyArg_ParseTuple(args, "O!",&Part::TopoShapePy::Type,&shape))
return 0;
const TopoDS_Shape& s = static_cast<Part::TopoShapePy*>(shape)->getTopoShapePtr()->_Shape;
const TopTools_ListOfShape& list = this->getBRepOffsetAPI_MakePipeShellPtr()->Generated(s);
Py::List shapes;
TopTools_ListIteratorOfListOfShape it;
for (it.Initialize(list); it.More(); it.Next()) {
const TopoDS_Shape& s = it.Value();
shapes.append(Py::asObject(new TopoShapePy(new TopoShape(s))));
}
return Py::new_reference_to(shapes);
}
开发者ID:3DPrinterGuy,项目名称:FreeCAD,代码行数:16,代码来源:BRepOffsetAPI_MakePipeShellPyImp.cpp
示例12: toListOfStrings
Py::List toListOfStrings( Py::Object obj )
{
Py::List list;
if( obj.isList() )
list = obj;
else
list.append( obj );
// check all members of the list are strings
for( Py::List::size_type i=0; i<list.length(); i++ )
{
Py::String path_str( list[i] );
}
return list;
}
开发者ID:Formulka,项目名称:pysvn,代码行数:16,代码来源:pysvn_converters.cpp
示例13: operator
/*!
* @brief Format a WSGI application response as an HTTP response.
* @param status HTTP status line (without the HTTP version)
* @param headers a list of pairs of strings with HTTP headers
* @param body the response body
*/
void operator() ( const py::Bytes& status,
const py::List& headers, const py::Bytes& body )
{
// Send status line.
myStream
<< "HTTP/1.1 " << status << "\r\n";
bool contentlength = false;
// Send headers.
for ( py::ssize_t i = 0; (i < headers.size()); ++i )
{
const py::Tuple header(headers[i]);
const py::Bytes field(header[0]);
const py::Bytes value(header[1]);
if ( field == "Content-Length" ) {
contentlength = true;
}
myStream
<< field << ": " << value << "\r\n";
}
// More headers (if desired).
if ( !contentlength ) {
myStream
<< "Content-Length" << ": " << body.size() << "\r\n";
}
// Send body.
myStream
<< "\r\n" << body;
}
开发者ID:AndreLouisCaron,项目名称:cxxpy,代码行数:34,代码来源:wsgi.cpp
示例14: getObjectsByLabel
PyObject* DocumentPy::getObjectsByLabel(PyObject *args)
{
char *sName;
if (!PyArg_ParseTuple(args, "s",&sName)) // convert args: Python->C
return NULL; // NULL triggers exception
Py::List list;
std::string name = sName;
std::vector<DocumentObject*> objs = getDocumentPtr()->getObjects();
for (std::vector<DocumentObject*>::iterator it = objs.begin(); it != objs.end(); ++it) {
if (name == (*it)->Label.getValue())
list.append(Py::asObject((*it)->getPyObject()));
}
return Py::new_reference_to(list);
}
开发者ID:PixnBits,项目名称:FreeCAD_sf_master,代码行数:16,代码来源:DocumentPyImp.cpp
示例15: getEditorMode
PyObject* PropertyContainerPy::getEditorMode(PyObject *args)
{
char* name;
if (!PyArg_ParseTuple(args, "s", &name)) // convert args: Python->C
return NULL; // NULL triggers exception
App::Property* prop = getPropertyContainerPtr()->getPropertyByName(name);
Py::List ret;
if (prop) {
short Type = prop->getType();
if ((prop->testStatus(Property::ReadOnly)) || (Type & Prop_ReadOnly))
ret.append(Py::String("ReadOnly"));
if ((prop->testStatus(Property::Hidden)) || (Type & Prop_Hidden))
ret.append(Py::String("Hidden"));
}
return Py::new_reference_to(ret);
}
开发者ID:3DPrinterGuy,项目名称:FreeCAD,代码行数:17,代码来源:PropertyContainerPyImp.cpp
示例16: supportedProperties
PyObject* FeaturePythonPy::supportedProperties(PyObject *args)
{
if (!PyArg_ParseTuple(args, "")) // convert args: Python->C
return NULL; // NULL triggers exception
std::vector<Base::Type> ary;
Base::Type::getAllDerivedFrom(App::Property::getClassTypeId(), ary);
Py::List res;
for (std::vector<Base::Type>::iterator it = ary.begin(); it != ary.end(); ++it) {
Base::BaseClass *data = static_cast<Base::BaseClass*>(it->createInstance());
if (data) {
delete data;
res.append(Py::String(it->getName()));
}
}
return Py::new_reference_to(res);
}
开发者ID:Daedalus12,项目名称:FreeCAD_sf_master,代码行数:17,代码来源:FeaturePythonPyImp.cpp
示例17: getState
Py::List DocumentObjectPy::getState(void) const
{
DocumentObject* object = this->getDocumentObjectPtr();
Py::List list;
bool uptodate = true;
if (object->isTouched()) {
uptodate = false;
list.append(Py::String("Touched"));
}
if (object->isError()) {
uptodate = false;
list.append(Py::String("Invalid"));
}
if (object->isRecomputing()) {
uptodate = false;
list.append(Py::String("Recompute"));
}
if (object->isRestoring()) {
uptodate = false;
list.append(Py::String("Restore"));
}
if (object->testStatus(App::Expand)){
list.append(Py::String("Expanded"));
}
if (uptodate) {
list.append(Py::String("Up-to-date"));
}
return list;
}
开发者ID:SparkyCola,项目名称:FreeCAD,代码行数:29,代码来源:DocumentObjectPyImp.cpp
示例18: discretize
PyObject* TopoShapeEdgePy::discretize(PyObject *args)
{
PyObject* defl_or_num;
if (!PyArg_ParseTuple(args, "O", &defl_or_num))
return 0;
try {
BRepAdaptor_Curve adapt(TopoDS::Edge(getTopoShapePtr()->_Shape));
GCPnts_UniformAbscissa discretizer;
if (PyInt_Check(defl_or_num)) {
int num = PyInt_AsLong(defl_or_num);
discretizer.Initialize (adapt, num);
}
else if (PyFloat_Check(defl_or_num)) {
double defl = PyFloat_AsDouble(defl_or_num);
discretizer.Initialize (adapt, defl);
}
else {
PyErr_SetString(PyExc_TypeError, "Either int or float expected");
return 0;
}
if (discretizer.IsDone () && discretizer.NbPoints () > 0) {
Py::List points;
int nbPoints = discretizer.NbPoints ();
for (int i=1; i<=nbPoints; i++) {
gp_Pnt p = adapt.Value (discretizer.Parameter (i));
points.append(Py::Vector(Base::Vector3d(p.X(),p.Y(),p.Z())));
}
return Py::new_reference_to(points);
}
else {
PyErr_SetString(PyExc_Exception, "Descretization of curve failed");
return 0;
}
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
return 0;
}
PyErr_SetString(PyExc_Exception, "Geometry is not a curve");
return 0;
}
开发者ID:Daedalus12,项目名称:FreeCAD_sf_master,代码行数:45,代码来源:TopoShapeEdgePyImp.cpp
示例19: new_reference_to
PyObject* BSplineCurve2dPy::toBezier(PyObject *args)
{
if (!PyArg_ParseTuple(args, ""))
return 0;
Handle_Geom2d_BSplineCurve spline = Handle_Geom2d_BSplineCurve::DownCast
(this->getGeom2dBSplineCurvePtr()->handle());
Geom2dConvert_BSplineCurveToBezierCurve crt(spline);
Py::List list;
Standard_Integer arcs = crt.NbArcs();
for (Standard_Integer i=1; i<=arcs; i++) {
Handle_Geom2d_BezierCurve bezier = crt.Arc(i);
list.append(Py::asObject(new BezierCurve2dPy(new Geom2dBezierCurve(bezier))));
}
return Py::new_reference_to(list);
}
开发者ID:abdullahtahiriyo,项目名称:FreeCAD_sf_master,代码行数:18,代码来源:BSplineCurve2dPyImp.cpp
示例20: new_reference_to
PyObject *SelectionSingleton::sGetCompleteSelection(PyObject * /*self*/, PyObject *args, PyObject * /*kwd*/)
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
std::vector<SelectionSingleton::SelObj> sel;
sel = Selection().getCompleteSelection();
try {
Py::List list;
for (std::vector<SelectionSingleton::SelObj>::iterator it = sel.begin(); it != sel.end(); ++it) {
list.append(Py::asObject(it->pObject->getPyObject()));
}
return Py::new_reference_to(list);
}
catch (Py::Exception&) {
return 0;
}
}
开发者ID:AjinkyaDahale,项目名称:FreeCAD,代码行数:19,代码来源:Selection.cpp
注:本文中的py::List类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论