Libmagicxx v10.0.3
A modern C++23 wrapper for libmagic — the library that powers the Unix file command.
Loading...
Searching...
No Matches
Recognition::Utility::MarkTrackerAsCompleted Class Reference

RAII helper that marks a ProgressTracker as completed on destruction. More...

#include <progress_tracker.hpp>

Public Member Functions

 MarkTrackerAsCompleted (SharedProgressTrackerT shared_progress_tracker) noexcept
 Construct with a shared progress tracker.
 ~MarkTrackerAsCompleted ()
 Destructor that marks the tracker as completed.

Private Attributes

SharedProgressTrackerT m_shared_progress_tracker

Detailed Description

RAII helper that marks a ProgressTracker as completed on destruction.

This class ensures that a progress tracker is marked as completed when the scope exits, regardless of how the scope is exited (normal return, exception, early exit, etc.).

Usage Example

void ProcessFiles(SharedProgressTrackerT tracker) {
MarkTrackerAsCompleted guard(tracker);
// Process files...
// If an exception is thrown, tracker is still marked complete
} // tracker->MarkAsCompleted() called automatically
MarkTrackerAsCompleted(SharedProgressTrackerT shared_progress_tracker) noexcept
Construct with a shared progress tracker.
Definition progress_tracker.hpp:483
std::shared_ptr< ProgressTracker > SharedProgressTrackerT
Shared pointer type for ProgressTracker.
Definition progress_tracker.hpp:405
See also
ProgressTracker::MarkAsCompleted()
Since
10.0.0

Constructor & Destructor Documentation

◆ MarkTrackerAsCompleted()

Recognition::Utility::MarkTrackerAsCompleted::MarkTrackerAsCompleted ( SharedProgressTrackerT shared_progress_tracker)
inlineexplicitnoexcept

Construct with a shared progress tracker.

Parameters
[in]shared_progress_trackerTracker to mark as completed on destruction. May be null (no-op in that case).
Since
10.0.0

◆ ~MarkTrackerAsCompleted()

Recognition::Utility::MarkTrackerAsCompleted::~MarkTrackerAsCompleted ( )
inline

Destructor that marks the tracker as completed.

If the tracker is not null, calls MarkAsCompleted() on it.

Since
10.0.0

Member Data Documentation

◆ m_shared_progress_tracker

SharedProgressTrackerT Recognition::Utility::MarkTrackerAsCompleted::m_shared_progress_tracker
private

Tracker to complete on destruction.


The documentation for this class was generated from the following file: