File: config_delayed_merge_object.hpp

package info (click to toggle)
cpp-hocon 0.3.0-1.2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,320 kB
  • sloc: cpp: 12,223; makefile: 4
file content (59 lines) | stat: -rw-r--r-- 2,903 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#pragma once

#include <hocon/config_object.hpp>
#include <hocon/config_exception.hpp>
#include <internal/replaceable_merge_stack.hpp>
#include <internal/values/config_delayed_merge.hpp>

namespace hocon {

    class config_delayed_merge_object : public config_object, public unmergeable, public replaceable_merge_stack {
    public:
        config_delayed_merge_object(shared_origin origin, std::vector<shared_value> const& stack);

        resolve_result<shared_value> resolve_substitutions(resolve_context const& context, resolve_source const& source) const override;
        std::vector<shared_value> unmerged_values() const override;
        shared_value make_replacement(resolve_context const& context, int skipping) const override;

        shared_object with_value(path raw_path, shared_value value) const override;
        shared_object with_value(std::string key, shared_value value) const override;

        resolve_status get_resolve_status() const override { return resolve_status::UNRESOLVED; }

        std::vector<std::string> key_set() const override { throw not_resolved(); }

        // map interface
        bool is_empty() const override { throw not_resolved(); }
        size_t size() const override { throw not_resolved(); }
        shared_value operator[](std::string const& key) const override { throw not_resolved(); }
        shared_value get(std::string const& key) const override { throw not_resolved(); }
        iterator begin() const override { throw not_resolved(); }
        iterator end() const override { throw not_resolved(); }
        unwrapped_value unwrapped() const override;

        bool operator==(config_value const& other) const override;

        // container interface
        shared_value replace_child(shared_value const& child, shared_value replacement) const override;
        bool has_descendant(shared_value const& descendant) const override;


    protected:
        shared_value attempt_peek_with_partial_resolve(std::string const& key) const override;
        std::unordered_map<std::string, shared_value> const& entry_set() const override;
        shared_object without_path(path raw_path) const override;
        shared_object with_only_path(path raw_path) const override;
        shared_object with_only_path_or_null(path raw_path) const override;
        shared_object new_copy(resolve_status const& status, shared_origin origin) const override;
        bool ignores_fallbacks() const override;
        virtual void render(std::string& result, int indent, bool at_root, std::string const& at_key, config_render_options options) const override;
        virtual void render(std::string& result, int indent, bool at_root, config_render_options options) const override;

    private:
        not_resolved_exception not_resolved() const;

        const std::vector<shared_value> _stack;
    };

}  // namespace hocon::config_delayed_merge_object