KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sheet_synchronization_notifier.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) 2023 Ethan Chien <[email protected]>
5 * Copyright The KiCad Developers, see AUTHORS.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 2
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, see <https://www.gnu.org/licenses/>.
19 */
20
21
22#ifndef SHEET_SYNCHRONIZATION_NOTIFIER_H
23#define SHEET_SYNCHRONIZATION_NOTIFIER_H
24
27
29{
30public:
32
34
35 void Notify()
36 {
37 if( !ShouldIgnore() )
38 Sync();
39 }
40
42
43protected:
44 virtual bool ShouldIgnore() const = 0;
45
46 virtual void Sync() = 0;
47
48
49private:
51};
52
53
59{
60public:
62 PANEL_SYNC_SHEET_PINS* aPanel );
63
64protected:
65 bool ShouldIgnore() const override;
66
67 void Sync() override;
68
69private:
71};
72
73#endif
SHEET_FILE_CHANGE_NOTIFIER(SHEET_SYNCHRONIZATION_MODEL *aOwner, PANEL_SYNC_SHEET_PINS *aPanel)
SHEET_SYNCHRONIZATION_NOTIFIER(SHEET_SYNCHRONIZATION_MODEL *aOwner)
virtual bool ShouldIgnore() const =0
SHEET_SYNCHRONIZATION_MODEL * GetOwner() const
virtual ~SHEET_SYNCHRONIZATION_NOTIFIER()=default