Leonetienne/Hazelnupp
Simple, easy to use, command line parameter interface
IntValue.h
Go to the documentation of this file.
1#pragma once
2#include "Value.h"
3
4namespace Hazelnp
5{
6 /** Specializations for integer values (uses long long int)
7 */
8 class IntValue : public Value
9 {
10 public:
11 IntValue(const long long int& value);
12 ~IntValue() override {};
13
14 //! Will return a deeopopy of this object
15 Value* Deepcopy() const override;
16
17 //! Will return a string suitable for an std::ostream;
18 std::string GetAsOsString() const override;
19
20 //! Will return the raw value
21 const long long int& GetValue() const;
22
23 operator long long int() const;
24 operator int() const;
25
26
27 //! Will return the data as a long long int
28 long long int GetInt64() const override;
29 //! Will return the data as an int
30 int GetInt32() const override;
31
32 //! Will return the data as a long double
33 long double GetFloat64() const override;
34 //! Will return the data as a double
35 double GetFloat32() const override;
36
37 //! Will return the data as a string
38 std::string GetString() const override;
39
40 //! Throws HazelnuppValueNotConvertibleException
41 const std::vector<Value*>& GetList() const override;
42
43 private:
44 long long int value;
45 };
46}
Specializations for integer values (uses long long int)
Definition: IntValue.h:9
int GetInt32() const override
Will return the data as an int.
Definition: IntValue.cpp:49
std::string GetString() const override
Will return the data as a string.
Definition: IntValue.cpp:64
long double GetFloat64() const override
Will return the data as a long double.
Definition: IntValue.cpp:54
std::string GetAsOsString() const override
Will return a string suitable for an std::ostream;.
Definition: IntValue.cpp:20
const long long int & GetValue() const
Will return the raw value.
Definition: IntValue.cpp:27
Value * Deepcopy() const override
Will return a deeopopy of this object.
Definition: IntValue.cpp:15
IntValue(const long long int &value)
Definition: IntValue.cpp:7
const std::vector< Value * > & GetList() const override
Throws HazelnuppValueNotConvertibleException.
Definition: IntValue.cpp:72
double GetFloat32() const override
Will return the data as a double.
Definition: IntValue.cpp:59
long long int GetInt64() const override
Will return the data as a long long int.
Definition: IntValue.cpp:44
~IntValue() override
Definition: IntValue.h:12
Abstract class for values.
Definition: Value.h:11