Commit Graph

14 Commits

Author SHA1 Message Date
Seth Hillbrand 7c28c3838a Comment-only changes
Makes class comments conform to coding standards
2020-01-10 16:43:01 -08:00
Ian McInerney 9e5d52f92d Cleanup 2020-01-08 01:49:51 +00:00
jean-pierre charras 4c4b11b45f change UTF8& operator+=( wchar_t ch ) to UTF8& operator+=( unsigned ch ), because swig does not like wchar_t.
(on Linux, wchar_t is a unsigned int, on Windows a unsigned short, so always using a unsigned int do not create issues)
2017-12-08 17:57:53 +01:00
jean-pierre charras d958ab9460 Fix operator+= for UTF8 class
Added operator+=(wchar_t), as operator+=(char) was not sufficient to
handle multibyte characters present in UTF8.

Fixes: lp:1737143
* https://bugs.launchpad.net/kicad/+bug/1737143
2017-12-08 14:37:55 +01:00
Simon Richter eaa31dc11b Avoid initialization from non-constexpr
In-class initializers for "static const" class members must be constexpr,
however std::string is only "static const" itself and cannot be used
without compiler extensions.
2017-12-06 19:27:53 -05:00
Dick Hollenbeck 19e6bde09a Rewrite class UTF8 to contain rather than extend std::string storage.
This forces the compiler class specific features rather than borrowing
from the base class's std::string.  In some cases prior to this,
wxString( std::string ) was being called rather than UTF8::operator
wxString() leading to garbled wxStrings.

Added function UTF8::wx_str() which is of great convenience also.

Implicit conversions still work as before, and hopefully more reliably.
2017-07-26 08:30:12 -04:00
Dick Hollenbeck 4e7de8a761 Reverse commit 4011ed4e31.
This commit was too broad and not cognizant of the purpose of the class
UTF8.

Add MAYBE_VERIFY_UTF8() macro, which can trap non-UTF8 encoded strings in
debug builds.

Use that macro conditionally in class UTF8 to trap non-UTF8 encoded strings
being put into UTF8 instances.
2017-07-26 08:26:56 -04:00
Dick Hollenbeck e24990146d 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 13:23:09 -04:00
Simon Wells 09ef795a02 Minor coding style fixes in headers 2016-01-12 11:33:33 -05:00
jean-pierre charras f23bb59cd1 Python scripting: make UTF8 class accessible by python scripts. Add python method GetChars() to UTF8 class to get its char buffer.
See scripts/test_kicad_plugin.py for example.
2014-10-18 10:18:14 +02:00
Dick Hollenbeck 4f26386e8d Initial KIWAY (modular-kicad) work. Various tweeks. 2014-02-03 09:10:37 -06:00
Dick Hollenbeck c264823731 8 bit string relief via class UTF8 2014-01-01 20:17:07 -06:00
Dick Hollenbeck b9c56b2fc4 FIX: avoid use of wxFileName::GetModificationTime() when it can fail. 2013-12-24 13:09:41 -06:00
Dick Hollenbeck dba4fccec9 *) Change FOOTPRINT_LIST::ReadFootprintFiles( FP_LIB_TABLE*, const wxString*)
To use multiple working threads.  This entailed adding KiCad typedefs:
*) Add typedefs for MUTEX and MUTLOCK which mask the actual choices for the project.
*) Add FOOTPRINT_LIST::DisplayErrors( wxWindow* ) which is a single strategy for
   showing aggregated load errors.  Although what's there is only scaffolding
   and needs a volunteer who knows HTML pretty well.
*) Ensure all callers of ReadFootprintFiles() use the new DisplayErrors() function.   
*) Push utf8.cpp and utf8.h into common library for open use.
2013-12-09 12:09:58 -06:00