KiCad PCB EDA Suite
pin_number.h
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) 2015 Simon Richter
5  * Copyright (C) 2015 KiCad Developers, see CHANGELOG.TXT for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 3
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
25 #ifndef PIN_NUMBER_H_
26 #define PIN_NUMBER_H_ 1
27 
28 #include <wx/string.h>
29 
30 #include <set>
31 
32 typedef wxString PinNumber;
33 
35 {
36 public:
37  wxString GetSummary() const;
38 
39  static int Compare( PinNumber const &lhs, PinNumber const &rhs );
40 
41 private:
42  struct less
43  {
44  bool operator()( PinNumber const &lhs, PinNumber const &rhs ) const
45  {
46  return Compare( lhs, rhs ) < 0;
47  }
48  };
49 
50  typedef std::set< PinNumber, less > container_type;
51 
52 public:
53  typedef container_type::value_type value_type;
54  typedef container_type::iterator iterator;
55  typedef container_type::const_iterator const_iterator;
56 
57  void insert( value_type const &v ) { pins.insert( v ); }
58  container_type::size_type size() const { return pins.size(); }
59 
60  iterator begin() { return pins.begin(); }
61  iterator end() { return pins.end(); }
62  const_iterator begin() const { return pins.begin(); }
63  const_iterator end() const { return pins.end(); }
64 
65 private:
66  container_type pins;
67 };
68 
69 #endif
static int Compare(PinNumber const &lhs, PinNumber const &rhs)
Definition: pin_number.cpp:110
wxString PinNumber
Definition: pin_number.h:32
void insert(value_type const &v)
Definition: pin_number.h:57
bool operator()(PinNumber const &lhs, PinNumber const &rhs) const
Definition: pin_number.h:44
container_type::const_iterator const_iterator
Definition: pin_number.h:55
wxString GetSummary() const
Definition: pin_number.cpp:70
const_iterator end() const
Definition: pin_number.h:63
std::set< PinNumber, less > container_type
Definition: pin_number.h:50
iterator begin()
Definition: pin_number.h:60
iterator end()
Definition: pin_number.h:61
container_type::value_type value_type
Definition: pin_number.h:53
container_type::iterator iterator
Definition: pin_number.h:54
container_type::size_type size() const
Definition: pin_number.h:58
container_type pins
Definition: pin_number.h:66
const_iterator begin() const
Definition: pin_number.h:62