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 along
20 * with this program. If not, see <http://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
32class PROPERTY_BASE;
33
38{
39public:
40 virtual ~INSPECTABLE()
41 {
42 }
43
44 bool Set( PROPERTY_BASE* aProperty, wxAny& aValue, bool aNotify = true );
45
46 template <typename T>
47 bool Set( PROPERTY_BASE* aProperty, T aValue, bool aNotify = true );
48
49 bool Set( PROPERTY_BASE* aProperty, wxVariant aValue, bool aNotify = true );
50
51 template <typename T>
52 bool Set( const wxString& aProperty, T aValue, bool aNotify = true );
53
54 wxAny Get( PROPERTY_BASE* aProperty ) const;
55
56 template <typename T>
57 T Get( PROPERTY_BASE* aProperty ) const;
58
59 template <typename T>
60 std::optional<T> Get( const wxString& aProperty ) const;
61};
62
63#endif /* INSPECTABLE_H */
Class that other classes need to inherit from, in order to be inspectable.
Definition inspectable.h:38
virtual ~INSPECTABLE()
Definition inspectable.h:40
wxAny Get(PROPERTY_BASE *aProperty) const
bool Set(PROPERTY_BASE *aProperty, wxAny &aValue, bool aNotify=true)