You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.6 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
  5. *
  6. * This program is free software: you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License as published by the
  8. * Free Software Foundation, either version 3 of the License, or (at your
  9. * option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful, but
  12. * WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License along
  17. * with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #include <ostream>
  20. #include <core/wx_stl_compat.h>
  21. // add this only if it is not in wxWidgets (for instance before 3.1.0)
  22. #ifdef USE_KICAD_WXSTRING_HASH
  23. size_t std::hash<wxString>::operator()( const wxString& s ) const
  24. {
  25. return std::hash<std::wstring>{}( s.ToStdWstring() );
  26. }
  27. #endif
  28. #ifdef USE_KICAD_WXPOINT_LESS_AND_HASH
  29. bool std::less<wxPoint>::operator()( const wxPoint& aA, const wxPoint& aB ) const
  30. {
  31. if( aA.x == aB.x )
  32. return aA.y < aB.y;
  33. return aA.x < aB.x;
  34. }
  35. #endif
  36. std::ostream& operator<<( std::ostream& out, const wxSize& size )
  37. {
  38. out << " width=\"" << size.GetWidth() << "\" height=\"" << size.GetHeight() << "\"";
  39. return out;
  40. }
  41. std::ostream& operator<<( std::ostream& out, const wxPoint& pt )
  42. {
  43. out << " x=\"" << pt.x << "\" y=\"" << pt.y << "\"";
  44. return out;
  45. }