| Leonetienne/Hazelnupp Simple, easy to use, command line parameter interface

Public Member Functions | List of all members
Hazelnp::ListValue Class Reference

Specializations for list values (uses std::vector<Value*>) More...

`#include <ListValue.h>`

Inheritance diagram for Hazelnp::ListValue:
[legend]
Collaboration diagram for Hazelnp::ListValue:
[legend]

## Public Member Functions
| ListValue ()
| ~ListValue () override
Value * | Deepcopy () 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...
void | AddValue (const Value *value)
| Will add this value to the list. More...
const std::vector< Value * > & | GetValue () const
| Will return the raw value. More...
| operator std::vector< Value * > () const
long long int | GetInt64 () const override
| Throws HazelnuppValueNotConvertibleException. More...
int | GetInt32 () const override
| Throws HazelnuppValueNotConvertibleException. More...
long double | GetFloat64 () const override
| Throws HazelnuppValueNotConvertibleException. More...
double | GetFloat32 () const override
| Throws HazelnuppValueNotConvertibleException. More...
std::string | GetString () const override
| Throws HazelnuppValueNotConvertibleException. More...
const std::vector< Value * > & | GetList () const override
| Will return this values list. More...
Public Member Functions inherited from Hazelnp::Value
virtual | ~Value ()
DATA_TYPE | GetDataType () const
| Will return the data type of this value. More...

## Additional Inherited Members
Protected Member Functions inherited from Hazelnp::Value
| Value (DATA_TYPE type)
Protected Attributes inherited from Hazelnp::Value
DATA_TYPE | type

## Detailed Description

Specializations for list values (uses std::vector<Value*>)

Definition at line 9 of file ListValue.h.

## Constructor & Destructor Documentation

## ◆ ListValue()

ListValue::ListValue | ( |  | ) |

Definition at line 7 of file ListValue.cpp.

7 :
8 Value(DATA_TYPE::LIST)
9 {
10 return;
11 }

## ◆ ~ListValue()

ListValue::~ListValue | ( |  | ) |
| override

Definition at line 13 of file ListValue.cpp.

14 {
15 for (Value* val : value)
16 delete val;
17
18 value.clear();
19
20 return;
21 }

## Member Function Documentation

## ◆ AddValue()

void ListValue::AddValue | ( | const Value * | value | ) |

Will add this value to the list.

Definition at line 33 of file ListValue.cpp.

34 {
35 this->value.emplace_back(value->Deepcopy());
36 return;
37 }

## ◆ Deepcopy()

Value * ListValue::Deepcopy | ( |  | ) | const
| override virtual

Will return a deeopopy of this object.

Implements Hazelnp::Value.

Definition at line 23 of file ListValue.cpp.

24 {
25 ListValue* newList = new ListValue();
26
27 for (const Value* val : value)
28 newList->AddValue(val);
29
30 return newList;
31 }

## ◆ GetAsOsString()

std::string ListValue::GetAsOsString | ( |  | ) | const
| override virtual

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

Implements Hazelnp::Value.

Definition at line 44 of file ListValue.cpp.

45 {
46 std::stringstream ss;
47
48 ss << "ListValue: [";
49
50 for (const Value* val : value)
51 {
52 ss << *val;
53 if (val != value.back())
54 ss << ", ";
55 }
56
57 ss << "]";
58
59 return ss.str();
60 }

## ◆ GetFloat32()

double ListValue::GetFloat32 | ( |  | ) | const
| override virtual

Throws HazelnuppValueNotConvertibleException.

Implements Hazelnp::Value.

Definition at line 84 of file ListValue.cpp.

85 {
86 throw HazelnuppValueNotConvertibleException();
87 }

## ◆ GetFloat64()

long double ListValue::GetFloat64 | ( |  | ) | const
| override virtual

Throws HazelnuppValueNotConvertibleException.

Implements Hazelnp::Value.

Definition at line 79 of file ListValue.cpp.

80 {
81 throw HazelnuppValueNotConvertibleException();
82 }

## ◆ GetInt32()

int ListValue::GetInt32 | ( |  | ) | const
| override virtual

Throws HazelnuppValueNotConvertibleException.

Implements Hazelnp::Value.

Definition at line 74 of file ListValue.cpp.

75 {
76 throw HazelnuppValueNotConvertibleException();
77 }

## ◆ GetInt64()

long long int ListValue::GetInt64 | ( |  | ) | const
| override virtual

Throws HazelnuppValueNotConvertibleException.

Implements Hazelnp::Value.

Definition at line 69 of file ListValue.cpp.

70 {
71 throw HazelnuppValueNotConvertibleException();
72 }

## ◆ GetList()

const std::vector< Value * > & ListValue::GetList | ( |  | ) | const
| override virtual

Will return this values list.

Implements Hazelnp::Value.

Definition at line 94 of file ListValue.cpp.

95 {
96 return value;
97 }

## ◆ GetString()

std::string ListValue::GetString | ( |  | ) | const
| override virtual

Throws HazelnuppValueNotConvertibleException.

Implements Hazelnp::Value.

Definition at line 89 of file ListValue.cpp.

90 {
91 throw HazelnuppValueNotConvertibleException();
92 }

## ◆ GetValue()

const std::vector< Value * > & ListValue::GetValue | ( |  | ) | const

Will return the raw value.

Definition at line 39 of file ListValue.cpp.

40 {
41 return value;
42 }

## ◆ operator std::vector< Value * >()

ListValue::operator std::vector< Value * > | ( |  | ) | const

Definition at line 62 of file ListValue.cpp.

63 {
64 return value;
65 }

The documentation for this class was generated from the following files:

- Hazelnupp/ListValue.h
- Hazelnupp/ListValue.cpp

Hazelnp::Value
Abstract class for values.
Definition: Value.h:10
Hazelnp::DATA_TYPE::LIST
@ LIST
Hazelnp::Value::Value
Value(DATA_TYPE type)
Definition: Value.cpp:5
Hazelnp::ListValue::AddValue
void AddValue(const Value *value)
Will add this value to the list.
Definition: ListValue.cpp:33
Hazelnp::ListValue::ListValue
ListValue()
Definition: ListValue.cpp:7
Hazelnp::Value::Deepcopy
virtual Value * Deepcopy() const =0
Will return a deeopopy of this object.
Hazelnp::ListValue
Specializations for list values (uses std::vector<Value*>)
Definition: ListValue.h:9
Hazelnp::HazelnuppValueNotConvertibleException
Gets thrown when an attempt is made to retrieve the wrong data type from a value, when the value not ...
Definition: HazelnuppException.h:38