voice_audio_multi/include/engine/framework/io/yaml.h
Fabio c36510c21e
Some checks failed
Linux Build / Linux cpu (push) Has been cancelled
Linux Build / Linux cpu-clang (push) Has been cancelled
Linux Build / Linux vulkan (push) Has been cancelled
mac-build / macOS CPU (push) Has been cancelled
Nix Build / Nix (cpu) (push) Has been cancelled
Nix Build / Nix (vulkan) (push) Has been cancelled
windows-build / Windows CPU (push) Has been cancelled
Initial import: audio.cpp with Orange Pi documentation
2026-11-04 19:05:22 +01:00

36 lines
1.8 KiB
C++

#pragma once
#include "engine/framework/io/config.h"
#include <optional>
#include <string>
#include <string_view>
#include <unordered_map>
#include <vector>
namespace engine::io::yaml {
struct FlattenedDocument {
ConfigMap scalars;
std::unordered_map<std::string, std::vector<std::string>> lists;
};
ConfigMap parse_scalar_mapping(std::string_view text);
FlattenedDocument parse_flattened_document(std::string_view text);
bool parse_bool_scalar(const std::string & value, const std::string & key);
std::string require_string(const FlattenedDocument & document, const std::string & key);
std::string optional_string(const FlattenedDocument & document, const std::string & key, std::string default_value);
int require_int(const FlattenedDocument & document, const std::string & key);
int64_t require_i64(const FlattenedDocument & document, const std::string & key);
float require_float(const FlattenedDocument & document, const std::string & key);
bool require_bool(const FlattenedDocument & document, const std::string & key);
bool optional_bool(const FlattenedDocument & document, const std::string & key, bool default_value);
std::optional<int> optional_int(const FlattenedDocument & document, const std::string & key);
std::optional<float> optional_float(const FlattenedDocument & document, const std::string & key);
float optional_f32(const FlattenedDocument & document, const std::string & key, float default_value);
std::optional<float> optional_nullable_f32(const FlattenedDocument & document, const std::string & key);
std::vector<std::string> require_list_strings(const FlattenedDocument & document, const std::string & key);
std::vector<int> require_list_int(const FlattenedDocument & document, const std::string & key);
std::vector<int64_t> require_list_i64(const FlattenedDocument & document, const std::string & key);
} // namespace engine::io::yaml