libdebugger: Add string setting type.
- Needed in order to properly implement a settings description for a remote interface.
This commit is contained in:
parent
9e4d0fd483
commit
25ec63dbf5
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||
* Copyright 2011-2013, Rene Gollent, rene@gollent.com.
|
||||
* Copyright 2011-2016, Rene Gollent, rene@gollent.com.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef SETTING_H
|
||||
@ -20,7 +20,8 @@ enum setting_type {
|
||||
SETTING_TYPE_OPTIONS,
|
||||
SETTING_TYPE_BOUNDED,
|
||||
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 {
|
||||
public:
|
||||
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
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013, Rene Gollent, rene@gollent.com.
|
||||
* Copyright 2013-2016, Rene Gollent, rene@gollent.com.
|
||||
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||
* 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
|
||||
|
||||
|
||||
@ -399,3 +416,22 @@ RectSettingImpl::DefaultRectValue() const
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user