File: config_number.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 (38 lines) | stat: -rw-r--r-- 1,146 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
#pragma once

#include <hocon/config_value.hpp>
#include <internal/simple_config_origin.hpp>

#include <string>

namespace hocon {

    class config_number : public config_value {
    public:
        config_number(shared_origin origin,
                      std::string original_text);

        std::string transform_to_string() const override;
        config_value::type value_type() const override;

        virtual int64_t long_value() const = 0;
        virtual double double_value() const = 0;
        bool is_whole() const;

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

        int int_value_range_checked(std::string const& path) const;

        static std::shared_ptr<config_number> new_number(
                shared_origin origin, int64_t value, std::string original_text);

        static std::shared_ptr<config_number> new_number(
                shared_origin origin, double value, std::string original_text);

    protected:
        std::string _original_text;
    };

}  // namespace hocon