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 
8 class Value
9 {
10 public:
11  virtual ~Value() {};
12 
14  virtual Value* Deepcopy() const = 0;
15 
17  virtual std::string GetAsOsString() const = 0;
18 
20  DATA_TYPE GetDataType() const;
21 
22  friend std::ostream& operator<< (std::ostream& os, const Value& v)
23  {
24  return os << v.GetAsOsString();
25  }
26 
28  virtual long long int GetInt64() const = 0;
30  virtual int GetInt32() const = 0;
31 
33  virtual long double GetFloat64() const = 0;
35  virtual double GetFloat32() const = 0;
36 
38  virtual std::string GetString() const = 0;
39 
41  virtual const std::vector<Value*>& GetList() const = 0;
42 
43 protected:
45 
47 };
DataType.h
DATA_TYPE
DATA_TYPE
The different data types a paramater can be.
Definition: DataType.h:5
Value::type
DATA_TYPE type
Definition: Value.h:46
Value::GetList
virtual const std::vector< Value * > & GetList() const =0
Will attempt to return the list-data.
Value
Abstract class for values.
Definition: Value.h:8
Value::Deepcopy
virtual Value * Deepcopy() const =0
Will return a deeopopy of this object.
Value::GetAsOsString
virtual std::string GetAsOsString() const =0
Will return a string suitable for an std::ostream.
Value::GetInt32
virtual int GetInt32() const =0
Will attempt to return the integer data (int)
Value::GetString
virtual std::string GetString() const =0
Will attempt to return the string-data.
Value::Value
Value(DATA_TYPE type)
Definition: Value.cpp:3
Value::operator<<
friend std::ostream & operator<<(std::ostream &os, const Value &v)
Definition: Value.h:22
Value::GetFloat64
virtual long double GetFloat64() const =0
Will attempt to return the floating-point data (long double)
Value::~Value
virtual ~Value()
Definition: Value.h:11
Value::GetInt64
virtual long long int GetInt64() const =0
Will attempt to return the integer data (long long)
Value::GetFloat32
virtual double GetFloat32() const =0
Will attempt to return the floating-point data (double)
Value::GetDataType
DATA_TYPE GetDataType() const
Will return the data type of this value.
Definition: Value.cpp:10