Libmagicxx v10.0.3
A modern C++23 wrapper for libmagic — the library that powers the Unix file command.
Loading...
Searching...
No Matches
percentage.hpp File Reference

Percentage value type for progress tracking. More...

#include <algorithm>
#include <cstdint>
#include <string>
Include dependency graph for percentage.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Recognition::Utility::Percentage
 A type-safe percentage value in the range [0, 100]. More...

Namespaces

namespace  Recognition
 Root namespace for the libmagicxx library.
namespace  Recognition::Utility
 Utility components for the libmagicxx library.

Detailed Description

Percentage value type for progress tracking.

This file defines the Percentage class, a simple value type that represents a percentage in the range [0, 100]. It provides automatic clamping to ensure values always remain valid.

Usage Examples

Direct construction:

Recognition::Utility::Percentage p2{150}; // Clamped to 100%
Recognition::Utility::Percentage p3{-10}; // Clamped to 0%
A type-safe percentage value in the range [0, 100].
Definition percentage.hpp:81

From completed/total steps:

See also
ProgressTracker