Skip to content

Commit 186e0f4

Browse files
committed
Check whitelist, revert formatting ?
1 parent 11b4967 commit 186e0f4

File tree

6 files changed

+273
-270
lines changed

6 files changed

+273
-270
lines changed

modules/yup_data_model/undo/yup_UndoManager.h

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ namespace yup
4444
@see UndoableAction
4545
*/
4646
class YUP_API UndoManager
47-
: public ReferenceCountedObject,
48-
private Timer
47+
: public ReferenceCountedObject
48+
, private Timer
4949
{
50-
public:
50+
public:
5151
using Ptr = ReferenceCountedObjectPtr<UndoManager>;
5252

5353
//==============================================================================
@@ -61,22 +61,22 @@ class YUP_API UndoManager
6161
6262
@param maxHistorySize The maximum number of items to keep in the history.
6363
*/
64-
UndoManager(int maxHistorySize);
64+
UndoManager (int maxHistorySize);
6565

6666
/**
6767
Creates a new UndoManager and starts the timer.
6868
6969
@param actionGroupThreshold The time used to coalesce actions in the same transaction.
7070
*/
71-
UndoManager(RelativeTime actionGroupThreshold);
71+
UndoManager (RelativeTime actionGroupThreshold);
7272

7373
/**
7474
Creates a new UndoManager and starts the timer.
7575
7676
@param maxHistorySize The maximum number of items to keep in the history.
7777
@param actionGroupThreshold The time used to coalesce actions in the same transaction.
7878
*/
79-
UndoManager(int maxHistorySize, RelativeTime actionGroupThreshold);
79+
UndoManager (int maxHistorySize, RelativeTime actionGroupThreshold);
8080

8181
//==============================================================================
8282
/**
@@ -86,7 +86,7 @@ class YUP_API UndoManager
8686
8787
@return true if the action was added and performed successfully, false otherwise.
8888
*/
89-
bool perform(UndoableAction::Ptr f);
89+
bool perform (UndoableAction::Ptr f);
9090

9191
//==============================================================================
9292
/**
@@ -103,11 +103,11 @@ class YUP_API UndoManager
103103
@return true if the action was added and performed successfully, false otherwise.
104104
*/
105105
template <class T, class F>
106-
bool perform(T object, F&& function)
106+
bool perform (T object, F&& function)
107107
{
108-
static_assert(std::is_base_of_v<ReferenceCountedObject, typename T::ReferencedType>);
108+
static_assert (std::is_base_of_v<ReferenceCountedObject, typename T::ReferencedType>);
109109

110-
return perform(new Item<typename T::ReferencedType>(object, std::forward<F>(function)));
110+
return perform (new Item<typename T::ReferencedType> (object, std::forward<F> (function)));
111111
}
112112

113113
//==============================================================================
@@ -121,7 +121,7 @@ class YUP_API UndoManager
121121
122122
@param transactionName The name of the transaction.
123123
*/
124-
void beginNewTransaction(StringRef transactionName);
124+
void beginNewTransaction (StringRef transactionName);
125125

126126
//==============================================================================
127127
/**
@@ -137,7 +137,7 @@ class YUP_API UndoManager
137137
138138
@return The name of the transaction.
139139
*/
140-
String getTransactionName(int index) const;
140+
String getTransactionName (int index) const;
141141

142142
//==============================================================================
143143
/**
@@ -152,7 +152,7 @@ class YUP_API UndoManager
152152
153153
@param newName the new name for the transaction
154154
*/
155-
void setCurrentTransactionName(StringRef newName);
155+
void setCurrentTransactionName (StringRef newName);
156156

157157
//==============================================================================
158158
/**
@@ -200,7 +200,7 @@ class YUP_API UndoManager
200200
201201
Disabling the undo manager will clear the history and stop the timer.
202202
*/
203-
void setEnabled(bool shouldBeEnabled);
203+
void setEnabled (bool shouldBeEnabled);
204204

205205
/**
206206
Checks if the undo manager is enabled.
@@ -236,51 +236,52 @@ class YUP_API UndoManager
236236
237237
@param undoManager The UndoManager to be used.
238238
*/
239-
ScopedTransaction(UndoManager& undoManager);
239+
ScopedTransaction (UndoManager& undoManager);
240240

241241
/**
242242
Constructs a ScopedTransaction object.
243243
244244
@param undoManager The UndoManager to be used.
245245
@param transactionName The name of the transaction.
246246
*/
247-
ScopedTransaction(UndoManager& undoManager, StringRef transactionName);
247+
ScopedTransaction (UndoManager& undoManager, StringRef transactionName);
248248

249249
/**
250250
Destructs the ScopedTransaction object.
251251
*/
252252
~ScopedTransaction();
253253

254-
private:
254+
private:
255255
UndoManager& undoManager;
256256
};
257257

258-
private:
258+
private:
259259
template <class T>
260260
struct Item : public UndoableAction
261261
{
262-
using PerformCallback = std::function<bool(typename T::Ptr, UndoableActionState)>;
262+
using PerformCallback = std::function<bool (typename T::Ptr, UndoableActionState)>;
263263

264-
Item(typename T::Ptr object, PerformCallback function)
265-
: object(object), function(std::move(function))
264+
Item (typename T::Ptr object, PerformCallback function)
265+
: object (object)
266+
, function (std::move (function))
266267
{
267-
jassert(this->function != nullptr);
268+
jassert (this->function != nullptr);
268269
}
269270

270-
bool perform(UndoableActionState stateToPerform) override
271+
bool perform (UndoableActionState stateToPerform) override
271272
{
272273
if (object.wasObjectDeleted())
273274
return false;
274275

275-
return function(*object, stateToPerform);
276+
return function (*object, stateToPerform);
276277
}
277278

278279
bool isValid() const override
279280
{
280-
return !object.wasObjectDeleted();
281+
return ! object.wasObjectDeleted();
281282
}
282283

283-
private:
284+
private:
284285
WeakReference<T> object;
285286
PerformCallback function;
286287
};
@@ -291,26 +292,26 @@ class YUP_API UndoManager
291292
using Ptr = ReferenceCountedObjectPtr<Transaction>;
292293

293294
Transaction() = default;
294-
explicit Transaction(StringRef name);
295+
explicit Transaction (StringRef name);
295296

296-
void add(UndoableAction::Ptr action);
297+
void add (UndoableAction::Ptr action);
297298
int size() const;
298299

299300
String getTransactionName() const;
300-
void setTransactionName(StringRef newName);
301+
void setTransactionName (StringRef newName);
301302

302-
bool perform(UndoableActionState stateToPerform) override;
303+
bool perform (UndoableActionState stateToPerform) override;
303304
bool isValid() const override;
304305

305-
private:
306+
private:
306307
String transactionName;
307308
UndoableAction::Array childItems;
308309
};
309310

310311
/** @internal */
311312
void timerCallback() override;
312313
/** @internal */
313-
bool internalPerform(UndoableActionState stateToPerform);
314+
bool internalPerform (UndoableActionState stateToPerform);
314315
/** @internal */
315316
bool flushCurrentTransaction();
316317

@@ -326,8 +327,8 @@ class YUP_API UndoManager
326327

327328
bool isUndoEnabled = false;
328329

329-
YUP_DECLARE_WEAK_REFERENCEABLE(UndoManager)
330-
YUP_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(UndoManager)
330+
YUP_DECLARE_WEAK_REFERENCEABLE (UndoManager)
331+
YUP_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (UndoManager)
331332
};
332333

333334
} // namespace yup

0 commit comments

Comments
 (0)