Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
ScopedSlowTask.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreTypes.h"
6#include "Internationalization/Text.h"
7#include "Misc/SlowTask.h"
8
9/**
10 * A scope block representing an amount of work divided up into sections.
11 * Use one scope at the top of each function to give accurate feedback to the user of a slow operation's progress.
12 *
13 * Example Usage:
14 * void DoSlowWork()
15 * {
16 * FScopedSlowTask Progress(2.f, LOCTEXT("DoingSlowWork", "Doing Slow Work..."));
17 * // Optionally make this show a dialog if not already shown
18 * Progress.MakeDialog();
19 *
20 * // Indicate that we are entering a frame representing 1 unit of work
21 * Progress.EnterProgressFrame(1.f);
22 *
23 * // DoFirstThing() can follow a similar pattern of creating a scope divided into frames. These contribute to their parent's progress frame proportionately.
24 * DoFirstThing();
25 *
26 * Progress.EnterProgressFrame(1.f);
27 * DoSecondThing();
28 * }
29 *
30 */
32{
33
34 /**
35 * Construct this scope from an amount of work to do, and a message to display
36 * @param InAmountOfWork Arbitrary number of work units to perform (can be a percentage or number of steps).
37 * 0 indicates that no progress frames are to be entered in this scope (automatically enters a frame encompassing the entire scope)
38 * @param InDefaultMessage A message to display to the user to describe the purpose of the scope
39 * @param bInEnabled When false, this scope will have no effect. Allows for proper scoped objects that are conditionally disabled.
40 */
41 FORCEINLINE FScopedSlowTask(float InAmountOfWork, const FText& InDefaultMessage = FText(), bool bInEnabled = true, FFeedbackContext& InContext = *GWarn)
42 : FSlowTask(InAmountOfWork, InDefaultMessage, bInEnabled, InContext)
43 {
44 Initialize();
45 }
46
48 {
49 Destroy();
50 }
51};
class FFeedbackContext * GWarn
#define FORCEINLINE
Definition Platform.h:644
Definition Text.h:357
FORCEINLINE FScopedSlowTask(float InAmountOfWork, const FText &InDefaultMessage=FText(), bool bInEnabled=true, FFeedbackContext &InContext= *GWarn)
FORCEINLINE ~FScopedSlowTask()
FSlowTask(float InAmountOfWork, const FText &InDefaultMessage=FText(), bool bInEnabled=true, FFeedbackContext &InContext= *GWarn)
void Destroy()
void Initialize()