KiCad PCB EDA Suite
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
component_class.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 The 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
21#ifndef PCBNEW_COMPONENT_CLASS_H
22#define PCBNEW_COMPONENT_CLASS_H
23
24#include <wx/string.h>
25#include <vector>
26
40{
41public:
43 enum class USAGE
44 {
45 STATIC,
46 DYNAMIC,
49 };
50
52 explicit COMPONENT_CLASS( const wxString& name, const USAGE aUsageContext ) :
53 m_name( name ), m_usageContext( aUsageContext )
54 {
55 }
56
60 wxString GetHumanReadableName() const;
61
63 const wxString& GetName() const { return m_name; }
64
66 void AddConstituentClass( COMPONENT_CLASS* componentClass );
67
69 const COMPONENT_CLASS* GetConstituentClass( const wxString& className ) const;
70
72 bool ContainsClassName( const wxString& className ) const;
73
75 bool IsEmpty() const;
76
78 const std::vector<COMPONENT_CLASS*>& GetConstituentClasses() const
79 {
81 }
82
85
87 void SetUsageContext( const USAGE aUsageContext ) { m_usageContext = aUsageContext; }
88
90 bool operator==( const COMPONENT_CLASS& aComponent ) const;
91
93 bool operator!=( const COMPONENT_CLASS& aComponent ) const;
94
95private:
97 wxString m_name;
98
100 std::vector<COMPONENT_CLASS*> m_constituentClasses;
101
104};
105
106#endif //PCBNEW_COMPONENT_CLASS_H
const char * name
Definition: DXF_plotter.cpp:59
A lightweight representation of a component class.
void SetUsageContext(const USAGE aUsageContext)
Sets the assignment context in which this component class is being used.
USAGE
The assignment context in which this component class is used.
bool operator!=(const COMPONENT_CLASS &aComponent) const
Tests two component classes for inequality based on full class name.
USAGE GetUsageContext() const
Gets the assignment context in which this component class is being used.
void AddConstituentClass(COMPONENT_CLASS *componentClass)
Adds a constituent component class to an effective component class.
bool ContainsClassName(const wxString &className) const
Determines if this (effective) component class contains a specific constituent class.
USAGE m_usageContext
The assignment context in which this component class is being used.
std::vector< COMPONENT_CLASS * > m_constituentClasses
The COMPONENT_CLASS objects contributing to this complete component class.
const wxString & GetName() const
Fetches the full name of this component class.
COMPONENT_CLASS(const wxString &name, const USAGE aUsageContext)
Construct a new component class.
const std::vector< COMPONENT_CLASS * > & GetConstituentClasses() const
Fetches a vector of the constituent classes for this (effective) class.
wxString m_name
The full name of the component class.
bool operator==(const COMPONENT_CLASS &aComponent) const
Tests two component classes for equality based on full class name.
const COMPONENT_CLASS * GetConstituentClass(const wxString &className) const
Returns a named constituent class of this component class, or nullptr if not found.
wxString GetHumanReadableName() const
Gets the consolidated name of this component class (which may be an aggregate).
bool IsEmpty() const
Determines if this (effective) component class is empty (i.e. no classes defined)