KiCad PCB EDA Suite
Loading...
Searching...
No Matches
wx_stl_compat.cpp
Go to the documentation of this file.
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
20#include <ostream>
21#include <core/wx_stl_compat.h>
22
23// add this only if it is not in wxWidgets (for instance before 3.1.0)
24#ifdef USE_KICAD_WXSTRING_HASH
25size_t std::hash<wxString>::operator()( const wxString& s ) const
26{
27 return std::hash<std::wstring>{}( s.ToStdWstring() );
28}
29#endif
30
31#ifdef USE_KICAD_WXPOINT_LESS_AND_HASH
32bool std::less<wxPoint>::operator()( const wxPoint& aA, const wxPoint& aB ) const
33{
34 if( aA.x == aB.x )
35 return aA.y < aB.y;
36
37 return aA.x < aB.x;
38}
39#endif
40
41
42wxString TowxString( const std::string_view& view )
43{
44 return wxString( view.data(), view.length() );
45}
46
47
48std::ostream& operator<<( std::ostream& out, const wxSize& size )
49{
50 out << " width=\"" << size.GetWidth() << "\" height=\"" << size.GetHeight() << "\"";
51 return out;
52}
53
54
55std::ostream& operator<<( std::ostream& out, const wxPoint& pt )
56{
57 out << " x=\"" << pt.x << "\" y=\"" << pt.y << "\"";
58 return out;
59}
std::ostream & operator<<(std::ostream &aStream, const EDA_TEXT &aText)
Definition: eda_text.cpp:1297
wxString TowxString(const std::string_view &view)