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
5namespace 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}
Specializations for string values (uses std::string)
Definition: StringValue.h:10
Value * Deepcopy() const override
Will return a deeopopy of this object.
Definition: StringValue.cpp:15
StringValue(const std::string &value)
Definition: StringValue.cpp:7
const std::vector< Value * > & GetList() const override
Throws HazelnuppValueNotConvertibleException.
Definition: StringValue.cpp:64
double GetFloat32() const override
Throws HazelnuppValueNotConvertibleException.
Definition: StringValue.cpp:54
~StringValue() override
Definition: StringValue.h:13
const std::string & GetValue() const
Will return the raw value.
Definition: StringValue.cpp:27
std::string GetAsOsString() const override
Will return a string suitable for an std::ostream;.
Definition: StringValue.cpp:20
long double GetFloat64() const override
Throws HazelnuppValueNotConvertibleException.
Definition: StringValue.cpp:49
std::string GetString() const override
Will return this value as a string.
Definition: StringValue.cpp:59
long long int GetInt64() const override
Throws HazelnuppValueNotConvertibleException.
Definition: StringValue.cpp:39
int GetInt32() const override
Throws HazelnuppValueNotConvertibleException.
Definition: StringValue.cpp:44
Abstract class for values.
Definition: Value.h:11