cpp-hocon  0.3.0
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 
8 namespace 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;
16  config_value::type value_type() 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
hocon::config_value::origin
virtual shared_origin const & origin() const
The origin of the value (file, line number, etc.), for debugging and error messages.
hocon::config_value::type
type
The type of a configuration value (following the JSON type schema).
Definition: config_value.hpp:56
hocon
Factory for creating config_document instances.
Definition: config.hpp:18
hocon::config_number
Definition: config_number.hpp:10
hocon::value
Definition: tokens.hpp:8
hocon::path
Definition: path.hpp:13
hocon::config_value
An immutable value, following the JSON type schema.
Definition: config_value.hpp:39
hocon::config_number::value_type
config_value::type value_type() const override
The type of the value; matches the JSON type schema.