Commit 9398eb97 authored by Miguel Angel Ajo's avatar Miguel Angel Ajo

std::vector and std::string items

DLIST iterator code, now we can do:

    for module in pcb.m_Modules:
    	print module.GetReference()

instead of:

    module = pcb.m_Modules

    while module:
	print module.GetReference()
	module = module.Next()

or even:
    module_list = list(pcb.m_Modules)
parent 7a256041
......@@ -180,9 +180,10 @@ BOARD *GetBoard();
%template(TRACK_List) DLIST<TRACK>;
%template(PAD_List) DLIST<D_PAD>;
/* TODO: -the std::* compilatio is broken with some swig + gcc combinations
* see kicad.i for more information.
* %template(MARKER_Vector) std::vector<MARKER_PCB*>;
* %template(ZONE_CONTAINER_Vector) std::vector<ZONE_CONTAINER*>;
*/
%template(MARKER_Vector) std::vector<MARKER_PCB*>;
%template(ZONE_CONTAINER_Vector) std::vector<ZONE_CONTAINER*>;
%template(VIA_DIMENSION_Vector) std::vector<VIA_DIMENSION>;
......@@ -30,10 +30,12 @@
/* OFF NOW, it triggers an error with GCC 4.6 and swig-2.0.4 or trunk..
http://sourceforge.net/tracker/index.php?func=detail&aid=3391906&group_id=1645&atid=101645
*/
%include <std_vector.i>
%include <std_string.i>
*/
%nodefaultctor EDA_ITEM;
......@@ -48,6 +50,7 @@
%ignore GetCommandOptions;
%{
#include <cstddef>
#include <dlist.h>
#include <base_struct.h>
#include <common.h>
......@@ -63,7 +66,6 @@
/* all the wx wrappers for wxString, wxPoint, wxRect, wxChar .. */
%include <wx.i>
%include <dlist.h>
%include <base_struct.h>
%include <common.h>
......@@ -71,9 +73,34 @@
%include <class_colors_design_settings.h>
/*
namespace std
%extend DLIST
{
%template(intVector) vector<int>;
%pythoncode
{
class DLISTIter:
def __init__(self,aList):
self.last = aList
def next(self):
if self.last is None:
raise StopIteration
else:
ret = None
# first item in list has "Get" as a DLIST
try:
ret = self.last.Get()
except:
ret = self.last #next items just not..
self.last = self.last.Next()
return ret
def __iter__(self):
return self.DLISTIter(self)
}
}
*/
%template(intVector) std::vector<int>;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment