#include <algorithm>
#include <array>
#include <cctype>
#include <iterator>
#include <ranges>
#include <stdexcept>
#include <string>
#include <string_view>
Go to the source code of this file.
|
| enum class | mazes::output_format : unsigned int {
JPG = 0
, JPEG = 1
, BMP = 2
, PLAIN_TEXT = 3
,
PLAIN_TEXT_ALT = 4
, PNG = 5
, JSON = 6
, OBJ = 7
,
STDOUT = 8
, B64 = 9
, TOTAL = 10
} |
| | Enum class for output_format types.
|
◆ output_format_or_default()
| output_format mazes::output_format_or_default |
( |
const std::string_view | sv, |
|
|
const output_format | fallback = output_format::PLAIN_TEXT ) |
|
inlinenoexcept |
Converts a string to an output_format enum, or returns a fallback if invalid.
- Parameters
-
| sv | The string representation of the output format. |
| fallback | The fallback output_format to return if the string is invalid. |
- Returns
- The corresponding output_format enum, or the fallback if invalid.
◆ stdout_format_from_sv()
| output_format mazes::stdout_format_from_sv |
( |
const std::string_view | sv | ) |
|
|
inlinenoexcept |
Check whether a bare format keyword (no file extension) targets stdout.
"stdout" prints the regular string, "obj" a Wavefront OBJ, and "b64" a base64-encoded string
- Parameters
-
| sv | The output argument value |
- Returns
- The matching output_format, or output_format::TOTAL if sv is not a stdout keyword
◆ to_output_format_from_sv()
| output_format mazes::to_output_format_from_sv |
( |
const std::string_view | sv | ) |
|
|
inline |
Convert a string to an output_format enum.
- Parameters
-
- Returns
◆ to_sv_from_output_format()
| std::string_view mazes::to_sv_from_output_format |
( |
output_format | of | ) |
|
|
inline |
Convert an output_format enum to a string.
- Parameters
-
- Returns
◆ OUTPUT_FORMAT_LABELS_LOWERCASE
| std::array<std::string_view, static_cast<size_t>(output_format::TOTAL)> mazes::OUTPUT_FORMAT_LABELS_LOWERCASE |
|
constexpr |
Initial value:= {
"jpg",
"jpeg",
"bmp",
"text",
"txt",
"png",
"json",
"obj",
"stdout",
"b64"}