Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/rfl/bson/Reader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ namespace bson {

/// Please refer to https://mongoc.org/libbson/current/api.html
struct Reader {
using UnsizedObjectReader = void;
struct BSONInputArray {
const bson_value_t* val_;
};
Expand Down
1 change: 1 addition & 0 deletions include/rfl/cbor/Reader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ namespace rfl::cbor {
/// than JSON while maintaining similar data model capabilities.
class Reader {
public:
using UnsizedObjectReader = void;
/// Represents a CBOR array during deserialization.
/// Wraps a pointer to the underlying jsoncons JSON value representing the
/// array.
Expand Down
1 change: 1 addition & 0 deletions include/rfl/cli/Reader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ rfl::Result<T> parse_value(
/// Parses hierarchical key-value pairs from CLI arguments (e.g., --database.host=localhost).
/// Supports arrays through comma-delimited values (e.g., --ports=8080,8081).
struct Reader {
using UnsizedObjectReader = void;
using InputArrayType = CliArrayType;
using InputObjectType = CliObjectType;
using InputVarType = CliVarType;
Expand Down
11 changes: 11 additions & 0 deletions include/rfl/env/Reader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ rfl::Result<T> parse_value(const std::string& _str,
/// arrays and objects, check for empty variables, and convert string values to
/// basic C++ types.
struct Reader {
using UnsizedObjectReader = void;
using InputArrayType = InputEnvArrayType;
using InputObjectType = InputEnvObjectType;
using InputVarType = InputEnvVarType;
Expand Down Expand Up @@ -240,6 +241,16 @@ struct Reader {
}
}

} else if constexpr (requires { _object_reader.field_names(); }) {
for (const auto name_sv : _object_reader.field_names()) {
const std::string name(name_sv);
const auto child_path = _obj.prefix.empty() ? name : _obj.prefix + name;
const auto var = InputVarType{.path = child_path};
if (!is_empty(var)) {
_object_reader.read(std::string_view(name), var);
}
}

} else {
for (char** env = get_environ(); *env != nullptr; ++env) {
const std::string env_entry(*env);
Expand Down
1 change: 1 addition & 0 deletions include/rfl/flexbuf/Reader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ namespace rfl {
namespace flexbuf {

struct Reader {
using UnsizedObjectReader = void;
using InputArrayType = flexbuffers::Vector;
using InputObjectType = flexbuffers::Map;
using InputVarType = flexbuffers::Reference;
Expand Down
1 change: 1 addition & 0 deletions include/rfl/generic/Reader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ namespace rfl::generic {
/// The Generic type can represent any JSON-like structure (objects, arrays, primitives)
/// without being tied to a specific serialization format.
struct Reader {
using UnsizedObjectReader = void;
using InputArrayType = Generic::Array;
using InputObjectType = Generic::Object;
using InputVarType = Generic;
Expand Down
Loading
Loading