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
|
|
|
|
*/
|
|
|
|
|
2019-05-30 13:33:59 +00:00
|
|
|
%include <std_deque.i>
|
2012-07-06 19:10:55 +00:00
|
|
|
%include <std_vector.i>
|
2018-08-31 09:31:54 +00:00
|
|
|
%include <std_list.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>
|
2019-07-25 18:53:26 +00:00
|
|
|
%include <stdint.i>
|
2016-09-20 15:59:43 +00:00
|
|
|
|
|
|
|
%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
|
2021-04-05 13:24:57 +00:00
|
|
|
private for most children, 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
|
|
|
|
2022-11-04 02:22:35 +00:00
|
|
|
%ignore to_json;
|
|
|
|
%ignore from_json;
|
|
|
|
|
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
|
|
|
%{
|
2020-10-21 11:23:06 +00:00
|
|
|
#include <outline_mode.h>
|
2020-10-24 03:33:04 +00:00
|
|
|
#include <macros_swig.h>
|
2020-10-24 04:00:49 +00:00
|
|
|
#include <kiid.h>
|
2012-07-06 19:10:55 +00:00
|
|
|
#include <cstddef>
|
2022-09-17 09:21:48 +00:00
|
|
|
#include <base_units.h>
|
2020-10-14 01:06:53 +00:00
|
|
|
#include <eda_item.h>
|
2020-10-24 14:45:37 +00:00
|
|
|
#include <eda_units.h>
|
2014-10-02 17:09:32 +00:00
|
|
|
#include <common.h>
|
2020-10-24 12:44:03 +00:00
|
|
|
#include <richio.h>
|
2014-10-02 17:09:32 +00:00
|
|
|
#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-28 21:13:40 +00:00
|
|
|
#include <marker_base.h>
|
2014-07-02 13:08:28 +00:00
|
|
|
#include <eda_text.h>
|
2019-05-26 07:12:03 +00:00
|
|
|
#include <id.h>
|
2020-02-05 12:28:44 +00:00
|
|
|
#include <build_version.h>
|
2021-07-29 09:47:43 +00:00
|
|
|
#include <layer_ids.h>
|
2020-01-13 01:44:19 +00:00
|
|
|
#include <settings/settings_manager.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
|
|
|
|
2018-12-19 17:34:29 +00:00
|
|
|
// SWIG is incompatible with std::unique_ptr
|
|
|
|
%ignore GetNewConfig;
|
|
|
|
|
2022-10-01 16:42:02 +00:00
|
|
|
// wrapper of BASE_SEQ (see typedef std::vector<PCB_LAYER_ID> BASE_SEQ;)
|
|
|
|
%template(base_seqVect) std::vector<enum PCB_LAYER_ID>;
|
|
|
|
|
|
|
|
// TODO: wrapper of BASE_SET (see std::bitset<PCB_LAYER_ID_COUNT> BASE_SET;)
|
|
|
|
|
|
|
|
|
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
|
2020-10-21 11:23:06 +00:00
|
|
|
%include <outline_mode.h>
|
2020-10-24 03:33:04 +00:00
|
|
|
%include macros_swig.h
|
2020-10-24 04:00:49 +00:00
|
|
|
%include kiid.h
|
2016-09-20 15:59:43 +00:00
|
|
|
%include core/typeinfo.h
|
2020-10-14 01:06:53 +00:00
|
|
|
%include eda_item.h
|
2022-09-17 09:21:48 +00:00
|
|
|
%include base_units.h
|
2020-10-24 14:45:37 +00:00
|
|
|
%include eda_units.h
|
2016-09-20 15:59:43 +00:00
|
|
|
%include common.h
|
2020-10-24 12:44:03 +00:00
|
|
|
%include richio.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-28 21:13:40 +00:00
|
|
|
%include marker_base.h
|
2016-09-20 15:59:43 +00:00
|
|
|
%include eda_text.h
|
2020-02-05 12:28:44 +00:00
|
|
|
%include build_version.h
|
2022-09-28 07:55:00 +00:00
|
|
|
%include layer_ids.h
|
2020-01-13 01:44:19 +00:00
|
|
|
%include settings/settings_manager.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
|
|
|
|
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
|
|
|
|
2018-07-23 00:45:15 +00:00
|
|
|
// Contains VECTOR2I
|
|
|
|
%include math.i
|
2022-01-02 20:23:17 +00:00
|
|
|
%template(VECTOR_VECTOR2I) std::vector<VECTOR2I>;
|
2018-07-23 00:45:15 +00:00
|
|
|
|
2022-01-14 04:55:50 +00:00
|
|
|
// Shapes/geometry
|
|
|
|
%include shape.i
|
2017-04-14 12:11:24 +00:00
|
|
|
|
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;
|
2018-12-20 13:47:11 +00:00
|
|
|
%rename(utf8_to_string) operator const std::string& () const;
|
2014-10-18 08:18:14 +00:00
|
|
|
|
|
|
|
#include <utf8.h>
|
|
|
|
%include <utf8.h>
|
|
|
|
|
2022-01-02 20:23:17 +00:00
|
|
|
|
2014-10-18 08:18:14 +00:00
|
|
|
%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
|
|
|
}
|