Skip to content

Commit 05b7f43

Browse files
committed
Code formatting
1 parent 69e5f30 commit 05b7f43

File tree

1 file changed

+34
-35
lines changed

1 file changed

+34
-35
lines changed

modules/yup_data_model/undo/yup_UndoManager.h

Lines changed: 34 additions & 35 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,52 +236,51 @@ 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)
266-
, function (std::move (function))
264+
Item(typename T::Ptr object, PerformCallback function)
265+
: object(object), function(std::move(function))
267266
{
268-
jassert (this->function != nullptr);
267+
jassert(this->function != nullptr);
269268
}
270269

271-
bool perform (UndoableActionState stateToPerform) override
270+
bool perform(UndoableActionState stateToPerform) override
272271
{
273272
if (object.wasObjectDeleted())
274273
return false;
275274

276-
return function (*object, stateToPerform);
275+
return function(*object, stateToPerform);
277276
}
278277

279278
bool isValid() const override
280279
{
281-
return ! object.wasObjectDeleted();
280+
return !object.wasObjectDeleted();
282281
}
283282

284-
private:
283+
private:
285284
WeakReference<T> object;
286285
PerformCallback function;
287286
};
@@ -292,26 +291,26 @@ class YUP_API UndoManager
292291
using Ptr = ReferenceCountedObjectPtr<Transaction>;
293292

294293
Transaction() = default;
295-
explicit Transaction (StringRef name);
294+
explicit Transaction(StringRef name);
296295

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

300299
String getTransactionName() const;
301-
void setTransactionName (StringRef newName);
300+
void setTransactionName(StringRef newName);
302301

303-
bool perform (UndoableActionState stateToPerform) override;
302+
bool perform(UndoableActionState stateToPerform) override;
304303
bool isValid() const override;
305304

306-
private:
305+
private:
307306
String transactionName;
308307
UndoableAction::Array childItems;
309308
};
310309

311310
/** @internal */
312311
void timerCallback() override;
313312
/** @internal */
314-
bool internalPerform (UndoableActionState stateToPerform);
313+
bool internalPerform(UndoableActionState stateToPerform);
315314
/** @internal */
316315
bool flushCurrentTransaction();
317316

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

328327
bool isUndoEnabled = false;
329328

330-
YUP_DECLARE_WEAK_REFERENCEABLE (UndoManager)
331-
YUP_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (UndoManager)
329+
YUP_DECLARE_WEAK_REFERENCEABLE(UndoManager)
330+
YUP_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(UndoManager)
332331
};
333332

334333
} // namespace yup

0 commit comments

Comments
 (0)