Leonetienne/Hazelnupp
Simple, easy to use, command line parameter interface
Value.h
Go to the documentation of this file.
1 #pragma once
2 #include "DataType.h"
3 #include <ostream>
4 #include <vector>
5 
6 namespace Hazelnp
7 {
10  class Value
11  {
12  public:
13  virtual ~Value() {};
14 
16  virtual Value* Deepcopy() const = 0;
17 
19  virtual std::string GetAsOsString() const = 0;
20 
22  DATA_TYPE GetDataType() const;
23 
24  friend std::ostream& operator<< (std::ostream& os, const Value& v)
25  {
26  return os << v.GetAsOsString();
27  }
28 
30  virtual long long int GetInt64() const = 0;
32  virtual int GetInt32() const = 0;
33 
35  virtual long double GetFloat64() const = 0;
37  virtual double GetFloat32() const = 0;
38 
40  virtual std::string GetString() const = 0;
41 
43  virtual const std::vector<Value*>& GetList() const = 0;
44 
45  protected:
47 
49  };
50 }
Hazelnp
Definition: DataType.h:4
DataType.h
Hazelnp::Value::GetFloat32
virtual double GetFloat32() const =0
Will attempt to return the floating-point data (double)
Hazelnp::Value
Abstract class for values.
Definition: Value.h:10
Hazelnp::Value::GetInt32
virtual int GetInt32() const =0
Will attempt to return the integer data (int)
Hazelnp::Value::GetString
virtual std::string GetString() const =0
Will attempt to return the string-data.
Hazelnp::Value::~Value
virtual ~Value()
Definition: Value.h:13
Hazelnp::Value::Value
Value(DATA_TYPE type)
Definition: Value.cpp:5
Hazelnp::Value::GetDataType
DATA_TYPE GetDataType() const
Will return the data type of this value.
Definition: Value.cpp:12
Hazelnp::Value::GetInt64
virtual long long int GetInt64() const =0
Will attempt to return the integer data (long long)
Hazelnp::Value::GetAsOsString
virtual std::string GetAsOsString() const =0
Will return a string suitable for an std::ostream.
Hazelnp::Value::GetList
virtual const std::vector< Value * > & GetList() const =0
Will attempt to return the list-data.
Hazelnp::Value::operator<<
friend std::ostream & operator<<(std::ostream &os, const Value &v)
Definition: Value.h:24
Hazelnp::DATA_TYPE
DATA_TYPE
The different data types a paramater can be.
Definition: DataType.h:8
Hazelnp::Value::type
DATA_TYPE type
Definition: Value.h:48
Hazelnp::Value::Deepcopy
virtual Value * Deepcopy() const =0
Will return a deeopopy of this object.
Hazelnp::Value::GetFloat64
virtual long double GetFloat64() const =0
Will attempt to return the floating-point data (long double)