10 std::string _asString =
"";
13 IVoidPointer* _value =
nullptr;
14 void* _unmanagedValue =
nullptr;
18 : _key(
key), _type(
type), _value(value) {}
21 : _key(
key), _type(
type), _unmanagedValue(value) {}
24 : _key(
key), _type(
type), _value(new VoidPointer<bool>(new bool(value))) {}
27 : _key(
key), _type(
type), _value(new VoidPointer<int>(new int(value))) {}
32 _value(new VoidPointer<unsigned int>(new unsigned int(value))) {}
35 : _key(
key), _type(
type), _value(new VoidPointer<double>(new double(value))) {}
40 _value(new VoidPointer<std::string>(new std::string(value))) {}
43 if (_value)
delete _value;
48 const char*
key()
const override {
return _key.c_str(); }
53 return _value->as<
bool>();
58 _value =
new VoidPointer<bool>(
new bool(value));
63 return _value->as<
int>();
68 _value =
new VoidPointer<int>(
new int(value));
73 return _value->as<
unsigned int>();
78 _value =
new VoidPointer<unsigned int>(
new unsigned int(value));
83 return _value->as<
double>();
88 _value =
new VoidPointer<double>(
new double(value));
94 return _value->as<std::string*>()->c_str();
99 _value =
new VoidPointer<std::string>(
new std::string(value));
104 return _unmanagedValue ? _unmanagedValue : _value->void_ptr();
109 _unmanagedValue = value;
144 _asString =
"(pointer)";
147 return _asString.c_str();
SpecDataValue(const char *key, SpecDataValueType type, int value)
void * pointer_value() const override
static ISpecDataValue * create(const char *key, void *value)
SpecDataValueType type() const override
static ISpecDataValue * create_bool(const char *key, bool value)
const char * key() const override
unsigned int unsigned_int_value() const override
static ISpecDataValue * create(const char *key, double value)
bool bool_value() const override
static ISpecDataValue * create_unsigned_int(const char *key, unsigned int value)
SpecDataValue(const char *key, SpecDataValueType type, const char *value)
static ISpecDataValue * create(const char *key, const char *value)
void string_value(const char *value) override
SpecDataValue(const char *key, SpecDataValueType type, void *value)
bool is_pointer() const override
static ISpecDataValue * create(const char *key, bool value)
SpecDataValue(const char *key, SpecDataValueType type, double value)
bool is_bool() const override
void unsigned_int_value(unsigned int value) override
void pointer_value(IVoidPointer *value) override
void key(const char *key) override
static ISpecDataValue * create_string(const char *key, const char *value)
void pointer_value(void *value) override
static ISpecDataValue * create(const char *key, unsigned int value)
bool is_string() const override
SpecDataValue(const char *key, SpecDataValueType type, bool value)
SpecDataValue(const char *key, SpecDataValueType type, IVoidPointer *value)
bool is_unsigned_int() const override
static ISpecDataValue * create_float(const char *key, double value)
bool is_float() const override
void float_value(double value) override
const char * string_value() const override
static ISpecDataValue * create(const char *key, int value)
void bool_value(bool value) override
const char * to_string() override
static ISpecDataValue * create_int(const char *key, int value)
static ISpecDataValue * create(const char *key, IVoidPointer *value)
SpecDataValue(const char *key, SpecDataValueType type, unsigned int value)
bool is_int() const override
static ISpecDataValue * create_pointer(const char *key, IVoidPointer *value)
void int_value(int value) override
double float_value() const override
int int_value() const override
~SpecDataValue() override
static ISpecDataValue * create_pointer(const char *key, void *value)