2012-03-17 17:30:03 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2012 NBEE Embedded Systems, Miguel Angel Ajo <miguelangel@nbee.es>
|
2017-04-14 12:11:24 +00:00
|
|
|
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
|
2012-03-17 17:30:03 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file kicad.i
|
|
|
|
* @brief General wrappers for kicad / wx structures and classes
|
|
|
|
*/
|
|
|
|
|
2012-07-06 19:10:55 +00:00
|
|
|
%include <std_vector.i>
|
2015-03-02 08:28:49 +00:00
|
|
|
%include <std_basic_string.i>
|
2012-07-06 19:10:55 +00:00
|
|
|
%include <std_string.i>
|
2014-10-02 17:09:32 +00:00
|
|
|
%include <std_map.i>
|
Pcbnew: major swig fix.
* Switched hashtables.h over to std::undordered_map from boost version.
* Added new macros DECL_VEC_FOR_SWIG() and DECL_MAP_FOR_SWIG() in macros.h.
These along with future DECL_HASH_FOR_SWIG() unify the declaration to swig
and C++ so that the resultant type name is common in both languages, and
the types AGREE.
* Fixed swigging of NETINFO_ITEM and NETINFO_LIST via magic.
* Newly exposed (python wrapped) are: D_PADS, TRACKS (was TRACK_PTRS),
NETNAME_MAP, NETCODE_MAP, wxString (without constructor purposely, read
comment in wx.i), MARKERS, ZONE_CONTAINERS, NETCLASSPTR, KICAD_T types.
* std::vector<SOMETHING*> tends to end up named SOMETHINGS in C++ and python.
Having the name consistent between like types is helpful, and between
languages. std::map<> ends up as SOMETHING_MAP.
* NETINFO_LIST::m_netNames and NETINFO_LIST::m_netCodes are now std::map
instead of hashtables, because swig does not yet support std::unordered_map.
* You can now get to any netclass or net info. NETNAMES_MAP and NETCODES_MAP
are traversable basically the same as a python dictionary using a python
string (not wsString) as the key! The wxString typemap converts python
string to wxString before the lookup happens. Iteration also works.
2016-07-18 17:23:09 +00:00
|
|
|
%include <std_shared_ptr.i>
|
2016-09-20 15:59:43 +00:00
|
|
|
%include <std_set.i>
|
|
|
|
|
|
|
|
%include "ki_exception.i" // affects all that follow it
|
2012-03-19 08:36:38 +00:00
|
|
|
|
Pcbnew: major swig fix.
* Switched hashtables.h over to std::undordered_map from boost version.
* Added new macros DECL_VEC_FOR_SWIG() and DECL_MAP_FOR_SWIG() in macros.h.
These along with future DECL_HASH_FOR_SWIG() unify the declaration to swig
and C++ so that the resultant type name is common in both languages, and
the types AGREE.
* Fixed swigging of NETINFO_ITEM and NETINFO_LIST via magic.
* Newly exposed (python wrapped) are: D_PADS, TRACKS (was TRACK_PTRS),
NETNAME_MAP, NETCODE_MAP, wxString (without constructor purposely, read
comment in wx.i), MARKERS, ZONE_CONTAINERS, NETCLASSPTR, KICAD_T types.
* std::vector<SOMETHING*> tends to end up named SOMETHINGS in C++ and python.
Having the name consistent between like types is helpful, and between
languages. std::map<> ends up as SOMETHING_MAP.
* NETINFO_LIST::m_netNames and NETINFO_LIST::m_netCodes are now std::map
instead of hashtables, because swig does not yet support std::unordered_map.
* You can now get to any netclass or net info. NETNAMES_MAP and NETCODES_MAP
are traversable basically the same as a python dictionary using a python
string (not wsString) as the key! The wxString typemap converts python
string to wxString before the lookup happens. Iteration also works.
2016-07-18 17:23:09 +00:00
|
|
|
/*
|
|
|
|
http://www.swig.org/Doc3.0/CPlusPlus11.html
|
|
|
|
7.3.3 Hash tables
|
|
|
|
|
|
|
|
The new hash tables in the STL are unordered_set, unordered_multiset,
|
|
|
|
unordered_map, unordered_multimap. These are not available in SWIG, but in
|
|
|
|
principle should be easily implemented by adapting the current STL containers.
|
|
|
|
|
|
|
|
%include <std_unordered_map.i>
|
|
|
|
*/
|
2012-03-17 17:30:03 +00:00
|
|
|
|
Pcbnew: major swig fix.
* Switched hashtables.h over to std::undordered_map from boost version.
* Added new macros DECL_VEC_FOR_SWIG() and DECL_MAP_FOR_SWIG() in macros.h.
These along with future DECL_HASH_FOR_SWIG() unify the declaration to swig
and C++ so that the resultant type name is common in both languages, and
the types AGREE.
* Fixed swigging of NETINFO_ITEM and NETINFO_LIST via magic.
* Newly exposed (python wrapped) are: D_PADS, TRACKS (was TRACK_PTRS),
NETNAME_MAP, NETCODE_MAP, wxString (without constructor purposely, read
comment in wx.i), MARKERS, ZONE_CONTAINERS, NETCLASSPTR, KICAD_T types.
* std::vector<SOMETHING*> tends to end up named SOMETHINGS in C++ and python.
Having the name consistent between like types is helpful, and between
languages. std::map<> ends up as SOMETHING_MAP.
* NETINFO_LIST::m_netNames and NETINFO_LIST::m_netCodes are now std::map
instead of hashtables, because swig does not yet support std::unordered_map.
* You can now get to any netclass or net info. NETNAMES_MAP and NETCODES_MAP
are traversable basically the same as a python dictionary using a python
string (not wsString) as the key! The wxString typemap converts python
string to wxString before the lookup happens. Iteration also works.
2016-07-18 17:23:09 +00:00
|
|
|
// ignore some constructors of EDA_ITEM that will make the build fail
|
|
|
|
|
|
|
|
%nodefaultctor EDA_ITEM;
|
2012-03-19 15:39:50 +00:00
|
|
|
%ignore EDA_ITEM::EDA_ITEM( EDA_ITEM* parent, KICAD_T idType );
|
|
|
|
%ignore EDA_ITEM::EDA_ITEM( KICAD_T idType );
|
|
|
|
%ignore EDA_ITEM::EDA_ITEM( const EDA_ITEM& base );
|
2012-03-17 17:30:03 +00:00
|
|
|
|
Pcbnew: major swig fix.
* Switched hashtables.h over to std::undordered_map from boost version.
* Added new macros DECL_VEC_FOR_SWIG() and DECL_MAP_FOR_SWIG() in macros.h.
These along with future DECL_HASH_FOR_SWIG() unify the declaration to swig
and C++ so that the resultant type name is common in both languages, and
the types AGREE.
* Fixed swigging of NETINFO_ITEM and NETINFO_LIST via magic.
* Newly exposed (python wrapped) are: D_PADS, TRACKS (was TRACK_PTRS),
NETNAME_MAP, NETCODE_MAP, wxString (without constructor purposely, read
comment in wx.i), MARKERS, ZONE_CONTAINERS, NETCLASSPTR, KICAD_T types.
* std::vector<SOMETHING*> tends to end up named SOMETHINGS in C++ and python.
Having the name consistent between like types is helpful, and between
languages. std::map<> ends up as SOMETHING_MAP.
* NETINFO_LIST::m_netNames and NETINFO_LIST::m_netCodes are now std::map
instead of hashtables, because swig does not yet support std::unordered_map.
* You can now get to any netclass or net info. NETNAMES_MAP and NETCODES_MAP
are traversable basically the same as a python dictionary using a python
string (not wsString) as the key! The wxString typemap converts python
string to wxString before the lookup happens. Iteration also works.
2016-07-18 17:23:09 +00:00
|
|
|
|
|
|
|
%warnfilter(401) EDA_ITEM;
|
|
|
|
%warnfilter(509) UTF8;
|
|
|
|
|
2012-03-17 17:30:03 +00:00
|
|
|
/* swig tries to wrap SetBack/SetNext on derived classes, but this method is
|
2012-07-06 19:10:55 +00:00
|
|
|
private for most childs, so if we don't ignore it won't compile */
|
2012-03-17 17:30:03 +00:00
|
|
|
|
|
|
|
%ignore EDA_ITEM::SetBack;
|
|
|
|
%ignore EDA_ITEM::SetNext;
|
|
|
|
|
Pcbnew: major swig fix.
* Switched hashtables.h over to std::undordered_map from boost version.
* Added new macros DECL_VEC_FOR_SWIG() and DECL_MAP_FOR_SWIG() in macros.h.
These along with future DECL_HASH_FOR_SWIG() unify the declaration to swig
and C++ so that the resultant type name is common in both languages, and
the types AGREE.
* Fixed swigging of NETINFO_ITEM and NETINFO_LIST via magic.
* Newly exposed (python wrapped) are: D_PADS, TRACKS (was TRACK_PTRS),
NETNAME_MAP, NETCODE_MAP, wxString (without constructor purposely, read
comment in wx.i), MARKERS, ZONE_CONTAINERS, NETCLASSPTR, KICAD_T types.
* std::vector<SOMETHING*> tends to end up named SOMETHINGS in C++ and python.
Having the name consistent between like types is helpful, and between
languages. std::map<> ends up as SOMETHING_MAP.
* NETINFO_LIST::m_netNames and NETINFO_LIST::m_netCodes are now std::map
instead of hashtables, because swig does not yet support std::unordered_map.
* You can now get to any netclass or net info. NETNAMES_MAP and NETCODES_MAP
are traversable basically the same as a python dictionary using a python
string (not wsString) as the key! The wxString typemap converts python
string to wxString before the lookup happens. Iteration also works.
2016-07-18 17:23:09 +00:00
|
|
|
// ignore other functions that cause trouble
|
2012-03-17 17:30:03 +00:00
|
|
|
|
|
|
|
%ignore InitKiCadAbout;
|
|
|
|
%ignore GetCommandOptions;
|
|
|
|
|
2013-11-01 15:29:50 +00:00
|
|
|
%rename(getWxRect) operator wxRect;
|
2017-03-07 12:06:00 +00:00
|
|
|
%rename(getBOX2I) operator BOX2I;
|
2012-04-06 18:13:03 +00:00
|
|
|
%ignore operator <<;
|
2012-04-06 19:46:45 +00:00
|
|
|
%ignore operator=;
|
2012-04-06 18:13:03 +00:00
|
|
|
|
2016-09-20 15:59:43 +00:00
|
|
|
%include dlist.i
|
2014-10-18 08:18:14 +00:00
|
|
|
|
Pcbnew: major swig fix.
* Switched hashtables.h over to std::undordered_map from boost version.
* Added new macros DECL_VEC_FOR_SWIG() and DECL_MAP_FOR_SWIG() in macros.h.
These along with future DECL_HASH_FOR_SWIG() unify the declaration to swig
and C++ so that the resultant type name is common in both languages, and
the types AGREE.
* Fixed swigging of NETINFO_ITEM and NETINFO_LIST via magic.
* Newly exposed (python wrapped) are: D_PADS, TRACKS (was TRACK_PTRS),
NETNAME_MAP, NETCODE_MAP, wxString (without constructor purposely, read
comment in wx.i), MARKERS, ZONE_CONTAINERS, NETCLASSPTR, KICAD_T types.
* std::vector<SOMETHING*> tends to end up named SOMETHINGS in C++ and python.
Having the name consistent between like types is helpful, and between
languages. std::map<> ends up as SOMETHING_MAP.
* NETINFO_LIST::m_netNames and NETINFO_LIST::m_netCodes are now std::map
instead of hashtables, because swig does not yet support std::unordered_map.
* You can now get to any netclass or net info. NETNAMES_MAP and NETCODES_MAP
are traversable basically the same as a python dictionary using a python
string (not wsString) as the key! The wxString typemap converts python
string to wxString before the lookup happens. Iteration also works.
2016-07-18 17:23:09 +00:00
|
|
|
// headers/imports that must be included in the _wrapper.cpp at top
|
2012-04-06 18:13:03 +00:00
|
|
|
|
2012-03-17 17:30:03 +00:00
|
|
|
%{
|
Pcbnew: major swig fix.
* Switched hashtables.h over to std::undordered_map from boost version.
* Added new macros DECL_VEC_FOR_SWIG() and DECL_MAP_FOR_SWIG() in macros.h.
These along with future DECL_HASH_FOR_SWIG() unify the declaration to swig
and C++ so that the resultant type name is common in both languages, and
the types AGREE.
* Fixed swigging of NETINFO_ITEM and NETINFO_LIST via magic.
* Newly exposed (python wrapped) are: D_PADS, TRACKS (was TRACK_PTRS),
NETNAME_MAP, NETCODE_MAP, wxString (without constructor purposely, read
comment in wx.i), MARKERS, ZONE_CONTAINERS, NETCLASSPTR, KICAD_T types.
* std::vector<SOMETHING*> tends to end up named SOMETHINGS in C++ and python.
Having the name consistent between like types is helpful, and between
languages. std::map<> ends up as SOMETHING_MAP.
* NETINFO_LIST::m_netNames and NETINFO_LIST::m_netCodes are now std::map
instead of hashtables, because swig does not yet support std::unordered_map.
* You can now get to any netclass or net info. NETNAMES_MAP and NETCODES_MAP
are traversable basically the same as a python dictionary using a python
string (not wsString) as the key! The wxString typemap converts python
string to wxString before the lookup happens. Iteration also works.
2016-07-18 17:23:09 +00:00
|
|
|
#include <macros.h>
|
2012-07-06 19:10:55 +00:00
|
|
|
#include <cstddef>
|
2014-10-02 17:09:32 +00:00
|
|
|
#include <base_struct.h>
|
2018-01-29 10:37:29 +00:00
|
|
|
#include <eda_rect.h>
|
2014-10-02 17:09:32 +00:00
|
|
|
#include <common.h>
|
|
|
|
#include <wx_python_helpers.h>
|
|
|
|
#include <cstddef>
|
2014-10-18 08:18:14 +00:00
|
|
|
#include <vector>
|
2015-03-02 08:28:49 +00:00
|
|
|
#include <bitset>
|
2014-10-02 17:09:32 +00:00
|
|
|
|
2018-01-29 10:37:29 +00:00
|
|
|
#include <title_block.h>
|
2018-01-31 08:23:20 +00:00
|
|
|
#include <colors_design_settings.h>
|
2018-01-28 21:13:40 +00:00
|
|
|
#include <marker_base.h>
|
2014-07-02 13:08:28 +00:00
|
|
|
#include <eda_text.h>
|
2014-10-02 17:09:32 +00:00
|
|
|
#include <convert_to_biu.h>
|
2012-03-17 17:30:03 +00:00
|
|
|
%}
|
|
|
|
|
Pcbnew: major swig fix.
* Switched hashtables.h over to std::undordered_map from boost version.
* Added new macros DECL_VEC_FOR_SWIG() and DECL_MAP_FOR_SWIG() in macros.h.
These along with future DECL_HASH_FOR_SWIG() unify the declaration to swig
and C++ so that the resultant type name is common in both languages, and
the types AGREE.
* Fixed swigging of NETINFO_ITEM and NETINFO_LIST via magic.
* Newly exposed (python wrapped) are: D_PADS, TRACKS (was TRACK_PTRS),
NETNAME_MAP, NETCODE_MAP, wxString (without constructor purposely, read
comment in wx.i), MARKERS, ZONE_CONTAINERS, NETCLASSPTR, KICAD_T types.
* std::vector<SOMETHING*> tends to end up named SOMETHINGS in C++ and python.
Having the name consistent between like types is helpful, and between
languages. std::map<> ends up as SOMETHING_MAP.
* NETINFO_LIST::m_netNames and NETINFO_LIST::m_netCodes are now std::map
instead of hashtables, because swig does not yet support std::unordered_map.
* You can now get to any netclass or net info. NETNAMES_MAP and NETCODES_MAP
are traversable basically the same as a python dictionary using a python
string (not wsString) as the key! The wxString typemap converts python
string to wxString before the lookup happens. Iteration also works.
2016-07-18 17:23:09 +00:00
|
|
|
// all the wx wrappers for wxString, wxPoint, wxRect, wxChar ..
|
2016-09-20 15:59:43 +00:00
|
|
|
%include wx.i
|
2012-03-17 17:30:03 +00:00
|
|
|
|
Pcbnew: major swig fix.
* Switched hashtables.h over to std::undordered_map from boost version.
* Added new macros DECL_VEC_FOR_SWIG() and DECL_MAP_FOR_SWIG() in macros.h.
These along with future DECL_HASH_FOR_SWIG() unify the declaration to swig
and C++ so that the resultant type name is common in both languages, and
the types AGREE.
* Fixed swigging of NETINFO_ITEM and NETINFO_LIST via magic.
* Newly exposed (python wrapped) are: D_PADS, TRACKS (was TRACK_PTRS),
NETNAME_MAP, NETCODE_MAP, wxString (without constructor purposely, read
comment in wx.i), MARKERS, ZONE_CONTAINERS, NETCLASSPTR, KICAD_T types.
* std::vector<SOMETHING*> tends to end up named SOMETHINGS in C++ and python.
Having the name consistent between like types is helpful, and between
languages. std::map<> ends up as SOMETHING_MAP.
* NETINFO_LIST::m_netNames and NETINFO_LIST::m_netCodes are now std::map
instead of hashtables, because swig does not yet support std::unordered_map.
* You can now get to any netclass or net info. NETNAMES_MAP and NETCODES_MAP
are traversable basically the same as a python dictionary using a python
string (not wsString) as the key! The wxString typemap converts python
string to wxString before the lookup happens. Iteration also works.
2016-07-18 17:23:09 +00:00
|
|
|
// header files that must be wrapped
|
2012-03-19 11:21:29 +00:00
|
|
|
|
2016-09-20 15:59:43 +00:00
|
|
|
%include macros.h
|
|
|
|
%include core/typeinfo.h
|
|
|
|
%include base_struct.h
|
2018-01-29 10:37:29 +00:00
|
|
|
%include eda_rect.h
|
2016-09-20 15:59:43 +00:00
|
|
|
%include common.h
|
2018-01-29 10:37:29 +00:00
|
|
|
%include title_block.h
|
2017-02-20 16:57:41 +00:00
|
|
|
%include gal/color4d.h
|
2018-01-31 08:23:20 +00:00
|
|
|
%include colors_design_settings.h
|
2018-01-28 21:13:40 +00:00
|
|
|
%include marker_base.h
|
2016-09-20 15:59:43 +00:00
|
|
|
%include eda_text.h
|
2012-03-17 17:30:03 +00:00
|
|
|
|
2018-03-27 16:36:40 +00:00
|
|
|
// Cast time_t to known type for Python
|
|
|
|
typedef long time_t;
|
2012-03-19 08:36:38 +00:00
|
|
|
|
Pcbnew: major swig fix.
* Switched hashtables.h over to std::undordered_map from boost version.
* Added new macros DECL_VEC_FOR_SWIG() and DECL_MAP_FOR_SWIG() in macros.h.
These along with future DECL_HASH_FOR_SWIG() unify the declaration to swig
and C++ so that the resultant type name is common in both languages, and
the types AGREE.
* Fixed swigging of NETINFO_ITEM and NETINFO_LIST via magic.
* Newly exposed (python wrapped) are: D_PADS, TRACKS (was TRACK_PTRS),
NETNAME_MAP, NETCODE_MAP, wxString (without constructor purposely, read
comment in wx.i), MARKERS, ZONE_CONTAINERS, NETCLASSPTR, KICAD_T types.
* std::vector<SOMETHING*> tends to end up named SOMETHINGS in C++ and python.
Having the name consistent between like types is helpful, and between
languages. std::map<> ends up as SOMETHING_MAP.
* NETINFO_LIST::m_netNames and NETINFO_LIST::m_netCodes are now std::map
instead of hashtables, because swig does not yet support std::unordered_map.
* You can now get to any netclass or net info. NETNAMES_MAP and NETCODES_MAP
are traversable basically the same as a python dictionary using a python
string (not wsString) as the key! The wxString typemap converts python
string to wxString before the lookup happens. Iteration also works.
2016-07-18 17:23:09 +00:00
|
|
|
// std template mappings
|
2012-03-19 11:21:29 +00:00
|
|
|
%template(intVector) std::vector<int>;
|
2014-10-18 08:18:14 +00:00
|
|
|
%template(str_utf8_Map) std::map< std::string,UTF8 >;
|
2012-03-19 08:36:38 +00:00
|
|
|
|
2017-03-13 03:19:33 +00:00
|
|
|
// wrapper of BASE_SEQ (see typedef std::vector<PCB_LAYER_ID> BASE_SEQ;)
|
|
|
|
%template(base_seqVect) std::vector<enum PCB_LAYER_ID>;
|
2015-03-02 08:28:49 +00:00
|
|
|
|
2017-03-13 03:19:33 +00:00
|
|
|
// TODO: wrapper of BASE_SET (see std::bitset<PCB_LAYER_ID_COUNT> BASE_SET;)
|
2015-03-02 08:28:49 +00:00
|
|
|
|
|
|
|
|
Pcbnew: major swig fix.
* Switched hashtables.h over to std::undordered_map from boost version.
* Added new macros DECL_VEC_FOR_SWIG() and DECL_MAP_FOR_SWIG() in macros.h.
These along with future DECL_HASH_FOR_SWIG() unify the declaration to swig
and C++ so that the resultant type name is common in both languages, and
the types AGREE.
* Fixed swigging of NETINFO_ITEM and NETINFO_LIST via magic.
* Newly exposed (python wrapped) are: D_PADS, TRACKS (was TRACK_PTRS),
NETNAME_MAP, NETCODE_MAP, wxString (without constructor purposely, read
comment in wx.i), MARKERS, ZONE_CONTAINERS, NETCLASSPTR, KICAD_T types.
* std::vector<SOMETHING*> tends to end up named SOMETHINGS in C++ and python.
Having the name consistent between like types is helpful, and between
languages. std::map<> ends up as SOMETHING_MAP.
* NETINFO_LIST::m_netNames and NETINFO_LIST::m_netCodes are now std::map
instead of hashtables, because swig does not yet support std::unordered_map.
* You can now get to any netclass or net info. NETNAMES_MAP and NETCODES_MAP
are traversable basically the same as a python dictionary using a python
string (not wsString) as the key! The wxString typemap converts python
string to wxString before the lookup happens. Iteration also works.
2016-07-18 17:23:09 +00:00
|
|
|
// KiCad plugin handling
|
2012-05-05 20:18:47 +00:00
|
|
|
%include "kicadplugins.i"
|
2012-07-06 19:10:55 +00:00
|
|
|
|
2014-11-06 15:27:22 +00:00
|
|
|
// map CPolyLine and classes used in CPolyLine:
|
|
|
|
#include <../polygon/PolyLine.h>
|
|
|
|
%include <../polygon/PolyLine.h>
|
|
|
|
|
2017-05-01 12:19:38 +00:00
|
|
|
#include <geometry/shape.h>
|
|
|
|
%include <geometry/shape.h>
|
|
|
|
|
2017-04-14 12:11:24 +00:00
|
|
|
#include <geometry/shape_poly_set.h>
|
|
|
|
%include <geometry/shape_poly_set.h>
|
|
|
|
|
2014-10-18 08:18:14 +00:00
|
|
|
// ignore warning relative to operator = and operator ++:
|
|
|
|
#pragma SWIG nowarn=362,383
|
|
|
|
|
|
|
|
// Rename operators defined in utf8.h
|
|
|
|
%rename(utf8_to_charptr) operator char* () const;
|
|
|
|
%rename(utf8_to_wxstring) operator wxString () const;
|
|
|
|
|
|
|
|
#include <utf8.h>
|
|
|
|
%include <utf8.h>
|
|
|
|
|
|
|
|
%extend UTF8
|
|
|
|
{
|
|
|
|
const char* Cast_to_CChar() { return (self->c_str()); }
|
|
|
|
|
|
|
|
%pythoncode
|
2015-01-04 07:19:04 +00:00
|
|
|
%{
|
2014-10-18 08:18:14 +00:00
|
|
|
|
2014-10-22 11:16:20 +00:00
|
|
|
# Get the char buffer of the UTF8 string
|
2014-10-18 08:18:14 +00:00
|
|
|
def GetChars(self):
|
|
|
|
return self.Cast_to_CChar()
|
2014-10-21 16:34:51 +00:00
|
|
|
|
2014-10-22 11:16:20 +00:00
|
|
|
# Convert the UTF8 string to a python string
|
|
|
|
# Same as GetChars(), but more easy to use in print command
|
2014-10-21 16:34:51 +00:00
|
|
|
def __str__(self):
|
|
|
|
return self.GetChars()
|
|
|
|
|
2015-01-04 07:19:04 +00:00
|
|
|
%}
|
2014-10-18 08:18:14 +00:00
|
|
|
}
|