cpp-hocon 0.3.0
Loading...
Searching...
No Matches
config_number.hpp
1#pragma once
2
3#include <hocon/config_value.hpp>
4#include <internal/simple_config_origin.hpp>
5
6#include <string>
7
8namespace hocon {
9
10 class config_number : public config_value {
11 public:
12 config_number(shared_origin origin,
13 std::string original_text);
14
15 std::string transform_to_string() const override;
17
18 virtual int64_t long_value() const = 0;
19 virtual double double_value() const = 0;
20 bool is_whole() const;
21
22 bool operator==(const config_number &other) const;
23 bool operator!=(const config_number &other) const;
24 bool operator==(config_value const& other) const override;
25
26 int int_value_range_checked(std::string const& path) const;
27
28 static std::shared_ptr<config_number> new_number(
29 shared_origin origin, int64_t value, std::string original_text);
30
31 static std::shared_ptr<config_number> new_number(
32 shared_origin origin, double value, std::string original_text);
33
34 protected:
35 std::string _original_text;
36 };
37
38} // namespace hocon
config_value::type value_type() const override
The type of the value; matches the JSON type schema.
An immutable value, following the JSON type schema.
virtual shared_origin const & origin() const
The origin of the value (file, line number, etc.), for debugging and error messages.
type
The type of a configuration value (following the JSON type schema).
Factory for creating config_document instances.
Definition: config.hpp:18