LMMS
Loading...
Searching...
No Matches
ModelVisitor.h
Go to the documentation of this file.
1/*
2 * ModelVisitor.h - visitors for automatable models
3 *
4 * Copyright (c) 2019-2019 Johannes Lorenz <j.git$$$lorenz-ho.me, $$$=@>
5 *
6 * This file is part of LMMS - https://lmms.io
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public
19 * License along with this program (see COPYING); if not, write to the
20 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301 USA.
22 *
23 */
24
25#ifndef LMMS_MODEL_VISITOR_H
26#define LMMS_MODEL_VISITOR_H
27
28namespace lmms
29{
30
31
33class BoolModel;
34class IntModel;
35class FloatModel;
36class ComboBoxModel;
38
40{
41 template<class ParentType = AutomatableModel, class ModelType>
42 void up(ModelType& m) { visit(static_cast<ParentType&>(m)); }
43public:
44 virtual void visit(AutomatableModel& ) {}
45 virtual void visit(BoolModel& m);
46 virtual void visit(IntModel& m);
47 virtual void visit(FloatModel& m);
48 virtual void visit(ComboBoxModel& m);
49 virtual void visit(TempoSyncKnobModel& m);
50 virtual ~ModelVisitor() = default;
51};
52
54{
55 template<class ParentType = AutomatableModel, class ModelType>
56 void up(const ModelType& m) {
57 visit(static_cast<const ParentType&>(m)); }
58public:
59 virtual void visit(const AutomatableModel& ) {}
60 virtual void visit(const BoolModel& m);
61 virtual void visit(const IntModel& m);
62 virtual void visit(const FloatModel& m);
63 virtual void visit(const ComboBoxModel& m);
64 virtual void visit(const TempoSyncKnobModel& m);
65 virtual ~ConstModelVisitor() = default;
66};
67
68
69} // namespace lmms
70
71#endif // LMMS_MODEL_VISITOR_H
Definition AutomatableModel.h:77
Definition AutomatableModel.h:497
Definition ComboBoxModel.h:39
Definition ModelVisitor.h:54
void up(const ModelType &m)
Definition ModelVisitor.h:56
virtual ~ConstModelVisitor()=default
virtual void visit(const AutomatableModel &)
Definition ModelVisitor.h:59
Definition AutomatableModel.h:463
Definition AutomatableModel.h:481
Definition ModelVisitor.h:40
virtual ~ModelVisitor()=default
void up(ModelType &m)
Definition ModelVisitor.h:42
virtual void visit(AutomatableModel &)
Definition ModelVisitor.h:44
Definition TempoSyncKnobModel.h:45
unsigned * m
Definition inflate.c:1559
Definition AudioAlsa.cpp:35