← Back to team overview

kicad-developers team mailing list archive

Re: [PATCH] Add/modify python APIs for querying available pcbnew footprints

 

resend, this time to the list and not just to Wayne. Keep forgetting that
the replyto is the person I'm directly replying to and not the group.

note that this is actually two mails I sent today.

Miles


On Thu, Mar 22, 2018 at 10:05 PM, miles mccoo <mail@xxxxxxxxxx> wrote:

> Attached is an updated/improved patch. I'm glad Wayne pushed back on this
> one.
>
> no more trailing space.
> fixed a couple copyright notices
> fixed a couple of spaces after parenthesis
>
> Instead of extending FootprintEnumerate, I've created a new function
> FootprintsInLib. It just gives a list of footprints based on a lib name.
>
> I've moved around some of the code in footprints.i to be more clear. In
> particular, each new function is wrapped in its own %inline block to make
> it clear that's what's happening.
>
> None of the changes interact with IO plugin.
>
> I also realized there's an easy way to avoid the ugly helper class I had
> for making stuff available to python. Generally, translations from c to
> python happen in two way:
> 1) SWIG just uses one of it's known translations
> 2) We give SWIG a translation in the form of a typemap
>
> The third way which didn't occur to me before:
> 3) just return a pointer to a PyObject. Since my FootprintInfo function is
> in an %inline block anyway. This was easy. Before, I was trying to shoehorn
> the situation into #2.
>
>
> Hopefully, the patch doesn't look so scary now.
>
>
> Miles
>
>
>
>
> On Thu, Mar 22, 2018 at 12:04 PM, miles mccoo <mail@xxxxxxxxxx> wrote:
>
>>
>>
>>
>>> Please configure your editor to remove tailing white space and follow
>>> the kicad coding policy for formatting the c++ code.
>>>
>>
>> I will be sure to remove trailing whitespace on my edits. Beyond that, I
>> believe I follow the curly brace placement, space after/before parens and
>> such rules. I try to be consistent with the file that I'm editing. (some
>> include function comments, some don't. Some have two blanks between
>> functions, some only one)...
>>
>> So, based on your feedback, I can't change in my process other than
>> trailing spaces.
>>
>> I have read the policy several times, so this is like a compiler telling
>> me syntax error and nothing else. All I need is keywords :-)
>>
>>
>>
>> High level comment on my change: *All I want is a list of footprint
>> library names and a list of footprint names within each.* That's it.
>> Other changes within this patch are an attempt to maintain backwards
>> compatibility while also not having multiple functions with basically the
>> same behavior.
>>
>>
>> *What I'm hearing is that you don't want the overloading of enumerate
>> footprints from a lib path and enumeration based on just the name? *The
>> ability to read a library path and enumerate within it was already there.
>>
>>
>>
>>
>>> You have mixed the footprint enumeration of symbol library table entries
>>> and the io plugin which is confusing.  These enumerations have separate
>>
>> intentions and should not be mixed.  If you need to open a footprint
>>> library outside of the footprint library table, you should use PLUGIN
>>>
>>
>>
>> Note that most of footprint.i is not new and not authored by me. My
>> changes don't want to open libraries but I did try to maintain
>> compatibility.
>>
>>
>>
>>> directly.  I think this kind of code belongs in your own personal
>>> library.  It's a bit too high level for kicad python api use.
>>>
>>
>>
>> I just want to know the names of the libraries and the names of the
>> footprints within them. That's it. The other stuff was already there.
>>
>>
>>
>>> The FOOTPRINT_INFO helper should be using LIB_ID not wxString to look up
>>> footprints.  I think this could be useful once you fix LIB_ID issue.
>>>
>>
>>
>> I don't think I understand your comment or perhaps you misread the
>> proposed change.
>>
>> This code:  SWIG_HELPER_CLASSES::FOOTPRINT_INFO FootprintInfo( const
>> wxString &modname )
>>
>>
>> Is there to introduce a function to pcbnew python "pcbnew.FootprintInfo"
>> and it returns to python space a tuple with information like the number of
>> pads, doc, keywords. It is not a class contructor.
>>
>> The helper class is merely to pass a bunch of strings/ints to swig world
>> (look in swig_typemaps.i). The only reason the helper is there is because
>> of the abstractness of pcbnew/kicad's FOOTPRINT_INFO class. I had a comment
>> on this in my previous mail.
>>
>>
>> In python space, there are no LIB_IDs. (at least not yet?)
>>
>>
>> The function is wrapped in a swig '%inline %{' block.
>> http://www.swig.org/Doc3.0/SWIGDocumentation.html#SWIG_nn43
>>
>>
>>
>>
>>
>>> The autodoc.i makes sense for providing more detailed api documention
>>> but I thought you could use the """ """ pydoc strings for this as well
>>> which would be easier to read.  Maybe I'm not fully understanding the
>>> autodoc.i feature.
>>>
>>
>>
>> pydoc strings, as I understand them, are used when defining a python
>> function in python. The autodoc feature of SWIG is to add such
>> pydoc/docstrings to c/c++ functions that are being exposed to the python
>> world.
>> http://www.swig.org/Doc3.0/SWIGDocumentation.html#Python_nn70
>>
>>
>>
>> Please advise on next steps..
>>
>> All I want is access to the list of library names and the names of the
>> footprints within each. I think it's reasonable to think that others might
>> want this.
>>
>> Miles
>>
>>
>>
>>
>>> Cheers,
>>>
>>> Wayne
>>>
>>> On 3/16/2018 11:25 AM, miles mccoo wrote:
>>> >
>>> > Note: I have attempted to follow the kicad coding standards. Surely,
>>> > there's something  that I missed.
>>> > Please, instead of: "syntax error. Please see the coding guidelines",
>>> > please give an idea of the nature of things I missed. ;-)
>>> >
>>> >
>>> > This change adds the python apis: GetLogicalLibs and FootprintInfo.
>>> > Extends FootprintEnumerate
>>> >
>>> > *GetLogicalLibs* will return the list of available footprint libraries
>>> > *FootprintEnumerate* lists the footprints in a library. It used to only
>>> > take a path to a .pretty library. Now,
>>> > it also excepts a library name
>>> > *FootprintInfo* will return basic information about a particular
>>> > footprint (num pads...)
>>> >
>>> >
>>> >
>>> > *A couple of interesting ways in which this patch may be different from
>>> > other python interface patches:*
>>> > created the file autodoc.i which gives help messages (docstrings as
>>> they
>>> > are called in python) for the new APIs. The default docstrings
>>> generated
>>> > by SWIG are often not that helpful. knowing that a function takes a
>>> > string is not enough. What should that string contain. It seemed to me
>>> > these messages should be together.
>>> >
>>> > created the file swig_typemaps.i: a vector<int>, by default is returned
>>> > as a point to a vector instance. in swig_typemaps.i should go
>>> directives
>>> > for when to expand stl templates as well as customized transformations
>>> > of helper classes.
>>> >
>>> > exposed pcb_edit_frame pointer stored in pcbnew_scripting_helpers to
>>> > other parts of the SWIG files. This doesn't expose it to python.
>>> > pcb_edit_frame has a lot of interesting methods and also many that
>>> > should be excluded.
>>> >
>>> >
>>> > Thank you to Orson (Maciej Sumiński) and Jeff Young for their hints in
>>> > this thread:
>>> > https://lists.launchpad.net/kicad-developers/msg34925.html
>>> >
>>> >
>>> >
>>> >
>>> > Miles
>>> >
>>> >
>>> >
>>> > for personal reference: patch 7/8
>>> >
>>> >
>>> > _______________________________________________
>>> > Mailing list: https://launchpad.net/~kicad-developers
>>> > Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>>> > Unsubscribe : https://launchpad.net/~kicad-developers
>>> > More help   : https://help.launchpad.net/ListHelp
>>> >
>>>
>>> _______________________________________________
>>> Mailing list: https://launchpad.net/~kicad-developers
>>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>>> Unsubscribe : https://launchpad.net/~kicad-developers
>>> More help   : https://help.launchpad.net/ListHelp
>>>
>>
>>
>
From 6e7865d7f6aedef168472bcfb351e9e75bfba8d2 Mon Sep 17 00:00:00 2001
From: Miles McCoo <mail@xxxxxxxxxx>
Date: Thu, 22 Mar 2018 21:55:50 +0100
Subject: [PATCH] This change adds the python apis: GetLogicalLibs,
 FootprintsInLib and FootprintInfo.
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------2.7.4"

This is a multi-part message in MIME format.
--------------2.7.4
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit


GetLogicalLibs will return the list of available footprint libraries
FootprintsInLib lists the footprints in a library based on the library's name.
FootprintInfo will return basic information about a particular footprint (num pads...)

A couple of interesting ways in which this patch may be different from other python interface patches:
created the file autodoc.i which gives help messages (docstrings as they are called in python) for the new APIs. The default docstrings generated by SWIG are often not that helpful. knowing that a function takes a string is not enough. What should that string contain. It seemed to me these messages should be together.

created the file swig_typemaps.i: a vector<int>, by default is returned as a point to a vector instance. in swig_typemaps.i should go directives for when to expand stl templates. Other reasons to have a typemap is to automagically convert classes into something like a python tuple, dict, or list.

exposed pcb_edit_frame pointer stored in pcbnew_scripting_helpers to other parts of the SWIG files. This doesn't expose it to python. pcb_edit_frame has a lot of interesting methods and also many that should be excluded.

Thank you to Orson (Maciej Sumiński) and Jeff Young for their hints.

This thread may be of interest: https://lists.launchpad.net/kicad-developers/msg34925.html
---
 pcbnew/CMakeLists.txt                    |   2 +
 pcbnew/swig/autodoc.i                    |  44 ++++++++++++
 pcbnew/swig/footprint.i                  | 114 ++++++++++++++++++++++++++++++-
 pcbnew/swig/pcbnew.i                     |  13 +++-
 pcbnew/swig/pcbnew_scripting_helpers.cpp |   8 ++-
 pcbnew/swig/pcbnew_scripting_helpers.h   |   3 +-
 pcbnew/swig/swig_typemaps.i              |  34 +++++++++
 7 files changed, 212 insertions(+), 6 deletions(-)
 create mode 100644 pcbnew/swig/autodoc.i
 create mode 100644 pcbnew/swig/swig_typemaps.i


--------------2.7.4
Content-Type: text/x-patch; name="0001-This-change-adds-the-python-apis-GetLogicalLibs-Foot.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0001-This-change-adds-the-python-apis-GetLogicalLibs-Foot.patch"

diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt
index 7a49a7f..a2c9c79 100644
--- a/pcbnew/CMakeLists.txt
+++ b/pcbnew/CMakeLists.txt
@@ -439,6 +439,7 @@ if( KICAD_SCRIPTING )   # Generate pcbnew.py and pcbnew_wrap.cxx using swig
         DEPENDS plotcontroller.h
         DEPENDS exporters/gendrill_Excellon_writer.h
         DEPENDS swig/pcbnew.i
+        DEPENDS swig/autodoc.i
         DEPENDS swig/board.i
         DEPENDS swig/board_connected_item.i
         DEPENDS swig/board_design_settings.i
@@ -456,6 +457,7 @@ if( KICAD_SCRIPTING )   # Generate pcbnew.py and pcbnew_wrap.cxx using swig
         DEPENDS swig/pad.i
         DEPENDS swig/pcb_text.i
         DEPENDS swig/plugins.i
+        DEPENDS swig/swig_typemaps.i
         DEPENDS swig/text_mod.i
         DEPENDS swig/track.i
         DEPENDS swig/units.i
diff --git a/pcbnew/swig/autodoc.i b/pcbnew/swig/autodoc.i
new file mode 100644
index 0000000..ded5a43
--- /dev/null
+++ b/pcbnew/swig/autodoc.i
@@ -0,0 +1,44 @@
+/*
+ * This program source code file is part of KiCad, a free EDA CAD application.
+ *
+ * Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you may find one here:
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ * or you may search the http://www.gnu.org website for the version 2 license,
+ * or you may write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
+ */
+
+
+// The purpose of this file is to contain the help message docstrings seens from
+// the python interface.
+// SWIG will generate a default docstring but that is limited to the signature
+// of the function.
+// By specifying these docstrings manually, we can include additional hints.
+
+%feature("autodoc", "return a list of modules in a library.
+Takes a library name:
+mods = pcbnew.FootprintsInLib('MountingHole')
+") FootprintsInLib;
+
+%feature("autodoc", "Returns information about a footprint.
+example: pcbnew.FootprintInfo('MountingHole:MountingHole_3.2mm_M3')
+The ':' delimiter between the library and modules is important.
+Example output:
+{ 'uniquepadcount': 0, 'padcount': 0, 'name': 'MountingHole_3.2mm_M3',
+  'lib': 'MountingHole', 'doc': 'Mounting Hole 3.2mm, no annular, M3',
+  'ordernum': 0, 'keywords': 'mounting hole 3.2mm no annular m3'}") FootprintInfo;
+
+%feature("autodoc", "returns a list of all available footprint libraries") GetLogicalLibs;
diff --git a/pcbnew/swig/footprint.i b/pcbnew/swig/footprint.i
index 844ea31..3ffc0d9 100644
--- a/pcbnew/swig/footprint.i
+++ b/pcbnew/swig/footprint.i
@@ -2,7 +2,7 @@
  * This program source code file is part of KiCad, a free EDA CAD application.
  *
  * Copyright (C) 2012 NBEE Embedded Systems, Miguel Angel Ajo <miguelangel@xxxxxxx>
- * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
+ * Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -36,6 +36,11 @@
 %template(MODULE_List)  DLIST<MODULE>;
 %{
 #include <class_module.h>
+#include <project.h>
+#include <footprint_info.h>
+#include <fp_lib_table.h>
+#include <kiway.h>
+#include <stdexcept>
 %}
 
 
@@ -97,6 +102,113 @@
     %}
 }
 
+
+%inline %{
+    wxArrayString FootprintsInLib( const wxString& libname )
+    {
+        /* here, we enumerate by the library's name (the nickname)
+           for example:
+           mods = pcbnew.FootprintInLib( 'MountingHole' )
+           print("lib has {} modules", len(mods))
+        */
+        PCB_EDIT_FRAME* edit_frame = ScriptingGetPcbEditFrame();
+        if ( edit_frame )
+        {
+            PROJECT *prj =  &edit_frame->Prj();
+            FP_LIB_TABLE* fp_table = prj->PcbFootprintLibs( edit_frame->Kiway() );
+
+            try
+            {
+                wxArrayString aFootprintNames;
+                fp_table->FootprintEnumerate( aFootprintNames, libname );
+                return aFootprintNames;
+            }
+            catch ( IO_ERROR& e )
+            {
+                std::cout << "got IO_ERROR " << e.Problem() << " at " << e.Where() << std::endl;
+            }
+        }
+
+        return {};
+    }
+%}
+
+
+%inline %{
+    /* This function enables this python code:
+       for lib in pcbnew.GetLogicalLibs():
+           mods = pcbnew.FootprintsInLib( lib )
+           print( "lib {} has {} modules".format( lib, len( mods ) ) )
+    */
+    std::vector<wxString> GetLogicalLibs()
+    {
+        PCB_EDIT_FRAME* edit_frame = ScriptingGetPcbEditFrame();
+        if ( edit_frame )
+        {
+            PROJECT *prj =  &edit_frame->Prj();
+            FP_LIB_TABLE* fp_table = prj->PcbFootprintLibs( edit_frame->Kiway() );
+            return fp_table->GetLogicalLibs();
+        }
+
+        return {};
+    }
+%}
+
+
+%inline %{
+    /* This function returns information about a footprint. As an example. this:
+       pcbnew.FootprintInfo( 'MountingHole:MountingHole_3.2mm_M3' )
+       yields this:
+       { 'uniquepadcount': 0, 'padcount': 0, 'name': 'MountingHole_3.2mm_M3',
+         'lib': 'MountingHole', 'doc': 'Mounting Hole 3.2mm, no annular, M3',
+         'ordernum': 0, 'keywords': 'mounting hole 3.2mm no annular m3'}
+
+       This function is different from most of the others:
+       * first, it's in an inline block.
+       * second, and more interesting, is that it returns a PyObject directly.
+         This is because the lookedup instance FOOTPRINT_INFO will go out of scope
+         when we leave this function. So we create a PyObject (actually a dict) here.
+    */
+    PyObject *FootprintInfo( const wxString &modname )
+    {
+        // I'm using BeforeLast because it returns the empty string if ':' is
+        // not found. makes it easy to check for success.
+        wxString libname = modname.BeforeLast( ':' );
+        if ( libname.IsEmpty() )
+        {
+            throw std::invalid_argument( std::string( "expected module name of format libname:modname. got ") +
+                                         modname.ToStdString() );
+        }
+
+        PCB_EDIT_FRAME* edit_frame = ScriptingGetPcbEditFrame();
+        if ( edit_frame )
+        {
+            PROJECT *prj =  &edit_frame->Prj();
+            std::unique_ptr<FOOTPRINT_LIST> fpl = FOOTPRINT_LIST::GetInstance( edit_frame->Kiway() );
+            fpl->ReadFootprintFiles( prj->PcbFootprintLibs(), &libname );
+            FOOTPRINT_INFO* footprint = fpl->GetModuleInfo( modname );
+            if ( footprint ) {
+                PyObject *retval = PyDict_New();
+
+                PyDict_SetItemString( retval, "name",     PyString_FromString( footprint->GetFootprintName() ) );
+                // I find nickname to be misleading. it's the name of the lib.
+                PyDict_SetItemString( retval, "lib",      PyString_FromString( footprint->GetNickname() ) );
+                PyDict_SetItemString( retval, "doc",      PyString_FromString( footprint->GetDoc() ) );
+                PyDict_SetItemString( retval, "keywords", PyString_FromString( footprint->GetKeywords() ) );
+
+                PyDict_SetItemString( retval, "padcount",       PyInt_FromLong( footprint->GetPadCount() ) );
+                PyDict_SetItemString( retval, "uniquepadcount", PyInt_FromLong( footprint->GetUniquePadCount() ) );
+                PyDict_SetItemString( retval, "ordernum",       PyInt_FromLong( footprint->GetOrderNum() ) );
+
+                return retval;
+            }
+        }
+
+        Py_INCREF( Py_None );
+        return Py_None;
+    }
+%}
+
 %pythoncode
 %{
     def GetPluginForPath(libname):
diff --git a/pcbnew/swig/pcbnew.i b/pcbnew/swig/pcbnew.i
index 3181df7..8bf797f 100644
--- a/pcbnew/swig/pcbnew.i
+++ b/pcbnew/swig/pcbnew.i
@@ -2,7 +2,7 @@
  * This program source code file is part of KiCad, a free EDA CAD application.
  *
  * Copyright (C) 2012 NBEE Embedded Systems, Miguel Angel Ajo <miguelangel@xxxxxxx>
- * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
+ * Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -35,6 +35,12 @@
 %include "docstrings.i"
 #endif
 
+// docstrings.i above comes from doxygen. The docstrings contained
+// in autodoc.i are manually writen for the python world.
+%include autodoc.i
+
+%include swig_typemaps.i
+
 // support for wchar_t
 %include "cwstring.i"
 
@@ -94,6 +100,9 @@ Therefore please help gather the subset of C++ functions for this class that do
 throw and add them here, before the class declarations.
 
 */
+HANDLE_EXCEPTIONS(FootprintEnumerate)
+HANDLE_EXCEPTIONS(FootprintInfo)
+HANDLE_EXCEPTIONS(footprintPyEnumerate)
 HANDLE_EXCEPTIONS(PLUGIN::Load)
 HANDLE_EXCEPTIONS(PLUGIN::Save)
 HANDLE_EXCEPTIONS(PLUGIN::FootprintEnumerate)
@@ -124,5 +133,3 @@ HANDLE_EXCEPTIONS(LoadBoard)
 %include footprint.i
 %include plugins.i
 %include units.i
-
-
diff --git a/pcbnew/swig/pcbnew_scripting_helpers.cpp b/pcbnew/swig/pcbnew_scripting_helpers.cpp
index 065c029..3ec2f39 100644
--- a/pcbnew/swig/pcbnew_scripting_helpers.cpp
+++ b/pcbnew/swig/pcbnew_scripting_helpers.cpp
@@ -2,7 +2,7 @@
  * This program source code file is part of KiCad, a free EDA CAD application.
  *
  * Copyright (C) 2012 NBEE Embedded Systems, Miguel Angel Ajo <miguelangel@xxxxxxx>
- * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
+ * Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -59,6 +59,12 @@ void ScriptingSetPcbEditFrame( PCB_EDIT_FRAME* aPcbEditFrame )
 }
 
 
+PCB_EDIT_FRAME* ScriptingGetPcbEditFrame()
+{
+    return s_PcbEditFrame;
+}
+
+
 BOARD* LoadBoard( wxString& aFileName )
 {
     if( aFileName.EndsWith( wxT( ".kicad_pcb" ) ) )
diff --git a/pcbnew/swig/pcbnew_scripting_helpers.h b/pcbnew/swig/pcbnew_scripting_helpers.h
index 6233b3a..8d9bea8 100644
--- a/pcbnew/swig/pcbnew_scripting_helpers.h
+++ b/pcbnew/swig/pcbnew_scripting_helpers.h
@@ -2,7 +2,7 @@
  * This program source code file is part of KiCad, a free EDA CAD application.
  *
  * Copyright (C) 2013 NBEE Embedded Systems SL, Miguel Angel Ajo <miguelangel@xxxxxx>
- * Copyright (C) 2013-2017 KiCad Developers, see AUTHORS.txt for contributors.
+ * Copyright (C) 2013-2018 KiCad Developers, see AUTHORS.txt for contributors.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -35,6 +35,7 @@
 #ifndef SWIG
 void    ScriptingSetPcbEditFrame( PCB_EDIT_FRAME* aPCBEdaFrame );
 
+PCB_EDIT_FRAME* ScriptingGetPcbEditFrame();
 #endif
 
 // For Python scripts: return the current board.
diff --git a/pcbnew/swig/swig_typemaps.i b/pcbnew/swig/swig_typemaps.i
new file mode 100644
index 0000000..8c370c8
--- /dev/null
+++ b/pcbnew/swig/swig_typemaps.i
@@ -0,0 +1,34 @@
+/*
+ * This program source code file is part of KiCad, a free EDA CAD application.
+ *
+ * Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you may find one here:
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ * or you may search the http://www.gnu.org website for the version 2 license,
+ * or you may write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
+ */
+
+
+%{
+#include <wx/string.h>
+#include <vector>
+%}
+
+%include "std_vector.i"
+namespace std
+{
+    %template( vector_wxstring ) vector<wxString>;
+}

--------------2.7.4--



Follow ups

References