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

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

#include <ListValue.h>

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

Public Member Functions

 ListValue ()
 
 ~ListValue () 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...
 
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 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 list values (uses std::vector<Value*>)

Definition at line 7 of file ListValue.h.

Constructor & Destructor Documentation

◆ ListValue()

ListValue::ListValue ( )

Definition at line 5 of file ListValue.cpp.

5  :
7 {
8  return;
9 }

◆ ~ListValue()

ListValue::~ListValue ( )
override

Definition at line 11 of file ListValue.cpp.

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

Member Function Documentation

◆ AddValue()

void ListValue::AddValue ( const Value value)

Will add this value to the list.

Definition at line 31 of file ListValue.cpp.

32 {
33  this->value.emplace_back(value->Deepcopy());
34  return;
35 }

◆ Deepcopy()

Value * ListValue::Deepcopy ( ) const
overridevirtual

Will return a deeopopy of this object.

Implements Value.

Definition at line 21 of file ListValue.cpp.

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

◆ GetAsOsString()

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

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

Implements Value.

Definition at line 42 of file ListValue.cpp.

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

◆ GetFloat32()

double ListValue::GetFloat32 ( ) const
overridevirtual

Throws HazelnuppValueNotConvertibleException.

Implements Value.

Definition at line 82 of file ListValue.cpp.

83 {
85 }

◆ GetFloat64()

long double ListValue::GetFloat64 ( ) const
overridevirtual

Throws HazelnuppValueNotConvertibleException.

Implements Value.

Definition at line 77 of file ListValue.cpp.

78 {
80 }

◆ GetInt32()

int ListValue::GetInt32 ( ) const
overridevirtual

Throws HazelnuppValueNotConvertibleException.

Implements Value.

Definition at line 72 of file ListValue.cpp.

73 {
75 }

◆ GetInt64()

long long int ListValue::GetInt64 ( ) const
overridevirtual

Throws HazelnuppValueNotConvertibleException.

Implements Value.

Definition at line 67 of file ListValue.cpp.

68 {
70 }

◆ GetList()

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

Will return this values list.

Implements Value.

Definition at line 92 of file ListValue.cpp.

93 {
94  return value;
95 }

◆ GetString()

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

Throws HazelnuppValueNotConvertibleException.

Implements Value.

Definition at line 87 of file ListValue.cpp.

88 {
90 }

◆ GetValue()

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

Will return the raw value.

Definition at line 37 of file ListValue.cpp.

38 {
39  return value;
40 }

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

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

Definition at line 60 of file ListValue.cpp.

61 {
62  return value;
63 }

The documentation for this class was generated from the following files:
ListValue::AddValue
void AddValue(const Value *value)
Will add this value to the list.
Definition: ListValue.cpp:31
ListValue
Specializations for list values (uses std::vector<Value*>)
Definition: ListValue.h:7
DATA_TYPE::LIST
@ LIST
ListValue::ListValue
ListValue()
Definition: ListValue.cpp:5
Value
Abstract class for values.
Definition: Value.h:8
Value::Deepcopy
virtual Value * Deepcopy() const =0
Will return a deeopopy of this object.
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
Value::Value
Value(DATA_TYPE type)
Definition: Value.cpp:3