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

Specializations for string values (uses std::string) More...

#include <StringValue.h>

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

Public Member Functions

 StringValue (const std::string &value)
 
 ~StringValue () 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...
 
const std::string & GetValue () const
 Will return the raw value. More...
 
 operator std::string () 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
 Will return this value as a string. More...
 
const std::vector< Value * > & GetList () const override
 Throws HazelnuppValueNotConvertibleException. 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 string values (uses std::string)

Definition at line 7 of file StringValue.h.

Constructor & Destructor Documentation

◆ StringValue()

StringValue::StringValue ( const std::string &  value)

Definition at line 5 of file StringValue.cpp.

6  :
8  value { value }
9 {
10  return;
11 }

◆ ~StringValue()

StringValue::~StringValue ( )
inlineoverride

Definition at line 11 of file StringValue.h.

11 {};

Member Function Documentation

◆ Deepcopy()

Value * StringValue::Deepcopy ( ) const
overridevirtual

Will return a deeopopy of this object.

Implements Value.

Definition at line 13 of file StringValue.cpp.

14 {
15  return new StringValue(value);
16 }

◆ GetAsOsString()

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

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

Implements Value.

Definition at line 18 of file StringValue.cpp.

19 {
20  std::stringstream ss;
21  ss << "StringValue: " << value;
22  return ss.str();
23 }

◆ GetFloat32()

double StringValue::GetFloat32 ( ) const
overridevirtual

Throws HazelnuppValueNotConvertibleException.

Implements Value.

Definition at line 52 of file StringValue.cpp.

53 {
55 }

◆ GetFloat64()

long double StringValue::GetFloat64 ( ) const
overridevirtual

Throws HazelnuppValueNotConvertibleException.

Implements Value.

Definition at line 47 of file StringValue.cpp.

48 {
50 }

◆ GetInt32()

int StringValue::GetInt32 ( ) const
overridevirtual

Throws HazelnuppValueNotConvertibleException.

Implements Value.

Definition at line 42 of file StringValue.cpp.

43 {
45 }

◆ GetInt64()

long long int StringValue::GetInt64 ( ) const
overridevirtual

Throws HazelnuppValueNotConvertibleException.

Implements Value.

Definition at line 37 of file StringValue.cpp.

38 {
40 }

◆ GetList()

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

Throws HazelnuppValueNotConvertibleException.

Implements Value.

Definition at line 62 of file StringValue.cpp.

63 {
65 }

◆ GetString()

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

Will return this value as a string.

Implements Value.

Definition at line 57 of file StringValue.cpp.

58 {
59  return value;
60 }

◆ GetValue()

const std::string & StringValue::GetValue ( ) const

Will return the raw value.

Definition at line 25 of file StringValue.cpp.

26 {
27  return value;
28 }

◆ operator std::string()

StringValue::operator std::string ( ) const

Definition at line 30 of file StringValue.cpp.

31 {
32  return value;
33 }

The documentation for this class was generated from the following files:
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
StringValue::StringValue
StringValue(const std::string &value)
Definition: StringValue.cpp:5
DATA_TYPE::STRING
@ STRING