Represents a value in the range [0, 100].
More...
#include <percentage.hpp>
|
| percentage (int percentage=0) noexcept |
| Construct percentage with a given value.
|
|
| percentage (std::uint64_t completed_steps, std::uint64_t total_steps) noexcept |
| Construct percentage from completed and total steps.
|
|
int | get () const noexcept |
|
void | set (int percentage) noexcept |
| Set the percentage value.
|
|
std::string | to_string () const noexcept |
| Convert percentage to string.
|
|
Represents a value in the range [0, 100].
◆ percentage() [1/2]
recognition::utility::percentage::percentage |
( |
int | percentage = 0 | ) |
|
|
inlineexplicitnoexcept |
Construct percentage with a given value.
- Parameters
-
percentage | Value in range [0, 100]. Clamped if out of range. Default is 0. |
◆ percentage() [2/2]
recognition::utility::percentage::percentage |
( |
std::uint64_t | completed_steps, |
|
|
std::uint64_t | total_steps ) |
|
inlinenoexcept |
Construct percentage from completed and total steps.
- Parameters
-
completed_steps | Number of steps completed. |
total_steps | Total number of steps. |
◆ get()
int recognition::utility::percentage::get |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
- Returns
- The percentage value.
◆ set()
void recognition::utility::percentage::set |
( |
int | percentage | ) |
|
|
inlinenoexcept |
Set the percentage value.
- Parameters
-
percentage | New value in range [0, 100]. Clamped if out of range. |
◆ to_string()
std::string recognition::utility::percentage::to_string |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
Convert percentage to string.
- Returns
- String representation of the percentage, in the format "???%".
◆ m_percentage
int recognition::utility::percentage::m_percentage |
|
private |
The documentation for this class was generated from the following file: