Leonetienne/Hazelnupp
Simple, easy to use, command line parameter interface
Public Member Functions | List of all members
IntValue Class Reference

Specializations for integer values (uses long long int) More...

#include <IntValue.h>

Inheritance diagram for IntValue:
Inheritance graph
[legend]
Collaboration diagram for IntValue:
Collaboration graph
[legend]

Public Member Functions

 IntValue (const long long int &value)
 
 ~IntValue () override
 
ValueDeepcopy () const override
 Will return a deeopopy of this object. More...
 
std::string GetAsOsString () const override
 Will return a string suitable for an std::ostream;. More...
 
const long long int & GetValue () const
 Will return the raw value. More...
 
 operator long long int () const
 
 operator int () const
 
long long int GetInt64 () const override
 Will return the data as a long long int. More...
 
int GetInt32 () const override
 Will return the data as an int. More...
 
long double GetFloat64 () const override
 Will return the data as a long double. More...
 
double GetFloat32 () const override
 Will return the data as a double. More...
 
std::string GetString () const override
 Will return the data as a string. More...
 
const std::vector< Value * > & GetList () const override
 Throws HazelnuppValueNotConvertibleException. More...
 
- Public Member Functions inherited from Value
virtual ~Value ()
 
DATA_TYPE GetDataType () const
 Will return the data type of this value. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Value
 Value (DATA_TYPE type)
 
- Protected Attributes inherited from Value
DATA_TYPE type
 

Detailed Description

Specializations for integer values (uses long long int)

Definition at line 6 of file IntValue.h.

Constructor & Destructor Documentation

◆ IntValue()

IntValue::IntValue ( const long long int &  value)

Definition at line 5 of file IntValue.cpp.

6  :
8  value { value }
9 {
10  return;
11 }

◆ ~IntValue()

IntValue::~IntValue ( )
inlineoverride

Definition at line 10 of file IntValue.h.

10 {};

Member Function Documentation

◆ Deepcopy()

Value * IntValue::Deepcopy ( ) const
overridevirtual

Will return a deeopopy of this object.

Implements Value.

Definition at line 13 of file IntValue.cpp.

14 {
15  return new IntValue(value);
16 }

◆ GetAsOsString()

std::string IntValue::GetAsOsString ( ) const
overridevirtual

Will return a string suitable for an std::ostream;.

Implements Value.

Definition at line 18 of file IntValue.cpp.

19 {
20  std::stringstream ss;
21  ss << "IntValue: " << value;
22  return ss.str();
23 }

◆ GetFloat32()

double IntValue::GetFloat32 ( ) const
overridevirtual

Will return the data as a double.

Implements Value.

Definition at line 57 of file IntValue.cpp.

58 {
59  return (double)value;
60 }

◆ GetFloat64()

long double IntValue::GetFloat64 ( ) const
overridevirtual

Will return the data as a long double.

Implements Value.

Definition at line 52 of file IntValue.cpp.

53 {
54  return (long double)value;
55 }

◆ GetInt32()

int IntValue::GetInt32 ( ) const
overridevirtual

Will return the data as an int.

Implements Value.

Definition at line 47 of file IntValue.cpp.

48 {
49  return (int)value;
50 }

◆ GetInt64()

long long int IntValue::GetInt64 ( ) const
overridevirtual

Will return the data as a long long int.

Implements Value.

Definition at line 42 of file IntValue.cpp.

43 {
44  return value;
45 }

◆ GetList()

const std::vector< Value * > & IntValue::GetList ( ) const
overridevirtual

Throws HazelnuppValueNotConvertibleException.

Implements Value.

Definition at line 70 of file IntValue.cpp.

71 {
73 }

◆ GetString()

std::string IntValue::GetString ( ) const
overridevirtual

Will return the data as a string.

Implements Value.

Definition at line 62 of file IntValue.cpp.

63 {
64  std::stringstream ss;
65  ss << value;
66 
67  return ss.str();
68 }

◆ GetValue()

const long long int & IntValue::GetValue ( ) const

Will return the raw value.

Definition at line 25 of file IntValue.cpp.

26 {
27  return value;
28 }

◆ operator int()

IntValue::operator int ( ) const

Definition at line 35 of file IntValue.cpp.

36 {
37  return (int)value;
38 }

◆ operator long long int()

IntValue::operator long long int ( ) const

Definition at line 30 of file IntValue.cpp.

31 {
32  return value;
33 }

The documentation for this class was generated from the following files:
HazelnuppValueNotConvertibleException
Gets thrown when an attempt is made to retrieve the wrong data type from a value, when the value not ...
Definition: HazelnuppException.h:33
DATA_TYPE::INT
@ INT
IntValue::IntValue
IntValue(const long long int &value)
Definition: IntValue.cpp:5
Value::Value
Value(DATA_TYPE type)
Definition: Value.cpp:3