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

StringValue.h
Go to the documentation of this file.
1 #pragma once
2 #include "Value.h"
3 #include <string>
4
5 namespace Hazelnp
6 {
7 /** Specializations for string values (uses std::string)
8 */
9 class StringValue : public Value
10 {
11 public:
12 StringValue(const std::string& value);
13 ~StringValue() override {};
14
15 //! Will return a deeopopy of this object
16 Value* Deepcopy() const override;
17
18 //! Will return a string suitable for an std::ostream;
19 std::string GetAsOsString() const override;
20
21 //! Will return the raw value
22 const std::string& GetValue() const;
23
24 operator std::string() const;
25
26 //! Throws HazelnuppValueNotConvertibleException
27 long long int GetInt64() const override;
28 //! Throws HazelnuppValueNotConvertibleException
29 int GetInt32() const override;
30
31 //! Throws HazelnuppValueNotConvertibleException
32 long double GetFloat64() const override;
33 //! Throws HazelnuppValueNotConvertibleException
34 double GetFloat32() const override;
35
36 //! Will return this value as a string
37 std::string GetString() const override;
38
39 //! Throws HazelnuppValueNotConvertibleException
40 const std::vector<Value*>& GetList() const override;
41
42 private:
43 std::string value;
44 };
45 }
Hazelnp
Definition: CmdArgsInterface.h:7
Hazelnp::StringValue::GetInt32
int GetInt32() const override
Throws HazelnuppValueNotConvertibleException.
Definition: StringValue.cpp:44
Hazelnp::StringValue::GetAsOsString
std::string GetAsOsString() const override
Will return a string suitable for an std::ostream;.
Definition: StringValue.cpp:20
Hazelnp::StringValue::StringValue
StringValue(const std::string &value)
Definition: StringValue.cpp:7
Hazelnp::Value
Abstract class for values.
Definition: Value.h:10
Hazelnp::StringValue::~StringValue
~StringValue() override
Definition: StringValue.h:13
Hazelnp::StringValue::GetInt64
long long int GetInt64() const override
Throws HazelnuppValueNotConvertibleException.
Definition: StringValue.cpp:39
Hazelnp::StringValue::GetString
std::string GetString() const override
Will return this value as a string.
Definition: StringValue.cpp:59
Hazelnp::StringValue::GetFloat32
double GetFloat32() const override
Throws HazelnuppValueNotConvertibleException.
Definition: StringValue.cpp:54
Hazelnp::StringValue::Deepcopy
Value * Deepcopy() const override
Will return a deeopopy of this object.
Definition: StringValue.cpp:15
Hazelnp::StringValue::GetFloat64
long double GetFloat64() const override
Throws HazelnuppValueNotConvertibleException.
Definition: StringValue.cpp:49
Hazelnp::StringValue::GetList
const std::vector< Value * > & GetList() const override
Throws HazelnuppValueNotConvertibleException.
Definition: StringValue.cpp:64
Hazelnp::StringValue
Specializations for string values (uses std::string)
Definition: StringValue.h:9
Hazelnp::StringValue::GetValue
const std::string & GetValue() const
Will return the raw value.
Definition: StringValue.cpp:27
Value.h