libdebugger: Add string setting type.
- Needed in order to properly implement a settings description for a remote interface.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2009, Ingo Weinhold, [email protected].
|
* Copyright 2009, Ingo Weinhold, [email protected].
|
||||||
* Copyright 2011-2013, Rene Gollent, [email protected].
|
* Copyright 2011-2016, Rene Gollent, [email protected].
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
#ifndef SETTING_H
|
#ifndef SETTING_H
|
||||||
@@ -20,7 +20,8 @@ enum setting_type {
|
|||||||
SETTING_TYPE_OPTIONS,
|
SETTING_TYPE_OPTIONS,
|
||||||
SETTING_TYPE_BOUNDED,
|
SETTING_TYPE_BOUNDED,
|
||||||
SETTING_TYPE_RANGE,
|
SETTING_TYPE_RANGE,
|
||||||
SETTING_TYPE_RECT
|
SETTING_TYPE_RECT,
|
||||||
|
SETTING_TYPE_STRING
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -106,6 +107,16 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class StringSetting : public virtual Setting {
|
||||||
|
public:
|
||||||
|
virtual setting_type Type() const;
|
||||||
|
|
||||||
|
virtual BVariant DefaultValue() const;
|
||||||
|
|
||||||
|
virtual const BString& DefaultStringValue() const = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class AbstractSetting : public virtual Setting {
|
class AbstractSetting : public virtual Setting {
|
||||||
public:
|
public:
|
||||||
AbstractSetting(const BString& id,
|
AbstractSetting(const BString& id,
|
||||||
@@ -230,4 +241,17 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class StringSettingImpl : public AbstractSetting, public StringSetting {
|
||||||
|
public:
|
||||||
|
StringSettingImpl(const BString& id,
|
||||||
|
const BString& name,
|
||||||
|
const BString& defaultValue);
|
||||||
|
|
||||||
|
virtual const BString& DefaultStringValue() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
BString fDefaultValue;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // SETTING_H
|
#endif // SETTING_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013, Rene Gollent, [email protected].
|
* Copyright 2013-2016, Rene Gollent, [email protected].
|
||||||
* Copyright 2009, Ingo Weinhold, [email protected].
|
* Copyright 2009, Ingo Weinhold, [email protected].
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
@@ -115,6 +115,23 @@ RectSetting::DefaultValue() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark - StringSetting
|
||||||
|
|
||||||
|
|
||||||
|
setting_type
|
||||||
|
StringSetting::Type() const
|
||||||
|
{
|
||||||
|
return SETTING_TYPE_STRING;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BVariant
|
||||||
|
StringSetting::DefaultValue() const
|
||||||
|
{
|
||||||
|
return DefaultStringValue().String();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark - AbstractSetting
|
// #pragma mark - AbstractSetting
|
||||||
|
|
||||||
|
|
||||||
@@ -399,3 +416,22 @@ RectSettingImpl::DefaultRectValue() const
|
|||||||
{
|
{
|
||||||
return fDefaultValue;
|
return fDefaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark - StringSettingImpl
|
||||||
|
|
||||||
|
|
||||||
|
StringSettingImpl::StringSettingImpl(const BString& id, const BString& name,
|
||||||
|
const BString& defaultValue)
|
||||||
|
:
|
||||||
|
AbstractSetting(id, name),
|
||||||
|
fDefaultValue(defaultValue)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const BString&
|
||||||
|
StringSettingImpl::DefaultStringValue() const
|
||||||
|
{
|
||||||
|
return fDefaultValue;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user