LMMS
Loading...
Searching...
No Matches
JournallingObject.h
Go to the documentation of this file.
1/*
2 * JournallingObject.h - declaration of class JournallingObject
3 *
4 * Copyright (c) 2006-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
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_JOURNALLING_OBJECT_H
26#define LMMS_JOURNALLING_OBJECT_H
27
28#include <QStack>
29
30#include "LmmsTypes.h"
31#include "SerializingObject.h"
32
33namespace lmms
34{
35
36class LMMS_EXPORT JournallingObject : public SerializingObject
37{
38public:
40 ~JournallingObject() override;
41
42 inline jo_id_t id() const
43 {
44 return m_id;
45 }
46
47 void saveJournallingState( const bool newState )
48 {
50 m_journalling = newState;
51 }
52
60
61 void addJournalCheckPoint();
62
63 QDomElement saveState( QDomDocument & _doc,
64 QDomElement & _parent ) override;
65
66 void restoreState( const QDomElement & _this ) override;
67
68 inline bool isJournalling() const
69 {
70 return m_journalling;
71 }
72
73 inline void setJournalling( const bool _sr )
74 {
75 m_journalling = _sr;
76 }
77
78 inline bool testAndSetJournalling( const bool newState )
79 {
80 const bool oldJournalling = m_journalling;
81 m_journalling = newState;
82 return oldJournalling;
83 }
84
86 {
87 return m_journallingStateStack.isEmpty();
88 }
89
90protected:
91 void changeID( jo_id_t _id );
92
93
94private:
96
98
100
101} ;
102
103
104} // namespace lmms
105
106#endif // LMMS_JOURNALLING_OBJECT_H
jo_id_t m_id
Definition JournallingObject.h:95
void restoreJournallingState()
Definition JournallingObject.h:53
void setJournalling(const bool _sr)
Definition JournallingObject.h:73
QStack< bool > m_journallingStateStack
Definition JournallingObject.h:99
bool isJournalling() const
Definition JournallingObject.h:68
JournallingObject()
Definition JournallingObject.cpp:36
jo_id_t id() const
Definition JournallingObject.h:42
bool isJournallingStateStackEmpty() const
Definition JournallingObject.h:85
void saveJournallingState(const bool newState)
Definition JournallingObject.h:47
bool m_journalling
Definition JournallingObject.h:97
bool testAndSetJournalling(const bool newState)
Definition JournallingObject.h:78
SerializingObject()
Definition SerializingObject.cpp:32
Definition AudioAlsa.cpp:35
std::uint32_t jo_id_t
Definition LmmsTypes.h:50