KiCad PCB EDA Suite
Loading...
Searching...
No Matches
inspectable.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) 2020 CERN
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 * @author Tomasz Wlostowski <[email protected]>
7 * @author Maciej Suminski <[email protected]>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 3
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
23#ifndef INSPECTABLE_H
24#define INSPECTABLE_H
25
26#include <wx/any.h>
27#include <wx/string.h>
28#include <wx/variant.h>
29
30#include <optional>
31#include <vector>
32
33class PROPERTY_BASE;
34
39{
40public:
41 virtual ~INSPECTABLE()
42 {
43 }
44
53 virtual std::vector<PROPERTY_BASE*> GetDynamicProperties() const
54 {
55 return {};
56 }
57
58 bool Set( PROPERTY_BASE* aProperty, wxAny& aValue, bool aNotify = true );
59
60 template <typename T>
61 bool Set( PROPERTY_BASE* aProperty, T aValue, bool aNotify = true );
62
63 bool Set( PROPERTY_BASE* aProperty, wxVariant aValue, bool aNotify = true );
64
65 template <typename T>
66 bool Set( const wxString& aProperty, T aValue, bool aNotify = true );
67
68 wxAny Get( PROPERTY_BASE* aProperty ) const;
69
70 template <typename T>
71 T Get( PROPERTY_BASE* aProperty ) const;
72
73 template <typename T>
74 std::optional<T> Get( const wxString& aProperty ) const;
75};
76
77#endif /* INSPECTABLE_H */
Class that other classes need to inherit from, in order to be inspectable.
Definition inspectable.h:39
virtual ~INSPECTABLE()
Definition inspectable.h:41
wxAny Get(PROPERTY_BASE *aProperty) const
bool Set(PROPERTY_BASE *aProperty, wxAny &aValue, bool aNotify=true)
virtual std::vector< PROPERTY_BASE * > GetDynamicProperties() const
Return dynamically-computed properties specific to this object instance (e.g.
Definition inspectable.h:53