SettingsMessage: Add uint16 and uint64 support

* Thanks to kottan I notices something was of..
* Added uInt16 and uInt64, I was missing UInt16.

Change-Id: Id136dbb5a81392a7a694ac1fbbd9aefbd7f77af3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3888
Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
Fredrik Modéen
2021-05-01 12:58:34 +00:00
committed by Adrien Destugues
parent c1eed5c7f3
commit 6cd4da00c0
2 changed files with 50 additions and 0 deletions
+6
View File
@@ -41,9 +41,11 @@ public:
status_t SetValue(const char* name, bool value);
status_t SetValue(const char* name, int8 value);
status_t SetValue(const char* name, int16 value);
status_t SetValue(const char* name, uint16 value);
status_t SetValue(const char* name, int32 value);
status_t SetValue(const char* name, uint32 value);
status_t SetValue(const char* name, int64 value);
status_t SetValue(const char* name, uint64 value);
status_t SetValue(const char* name, float value);
status_t SetValue(const char* name, double value);
status_t SetValue(const char* name,
@@ -68,12 +70,16 @@ public:
int8 defaultValue) const;
int16 GetValue(const char* name,
int16 defaultValue) const;
uint16 GetValue(const char* name,
uint16 defaultValue) const;
int32 GetValue(const char* name,
int32 defaultValue) const;
uint32 GetValue(const char* name,
uint32 defaultValue) const;
int64 GetValue(const char* name,
int64 defaultValue) const;
uint64 GetValue(const char* name,
uint64 defaultValue) const;
float GetValue(const char* name,
float defaultValue) const;
double GetValue(const char* name,
+44
View File
@@ -149,6 +149,18 @@ SettingsMessage::SetValue(const char* name, int16 value)
}
status_t
SettingsMessage::SetValue(const char* name, uint16 value)
{
status_t ret = ReplaceUInt16(name, value);
if (ret != B_OK)
ret = AddUInt16(name, value);
if (ret == B_OK)
_NotifyValueChanged(name);
return ret;
}
status_t
SettingsMessage::SetValue(const char* name, int32 value)
{
@@ -190,6 +202,18 @@ SettingsMessage::SetValue(const char* name, int64 value)
}
status_t
SettingsMessage::SetValue(const char* name, uint64 value)
{
status_t ret = ReplaceUInt64(name, value);
if (ret != B_OK)
ret = AddUInt64(name, value);
if (ret == B_OK)
_NotifyValueChanged(name);
return ret;
}
status_t
SettingsMessage::SetValue(const char* name, float value)
{
@@ -355,6 +379,16 @@ SettingsMessage::GetValue(const char* name, int16 defaultValue) const
}
uint16
SettingsMessage::GetValue(const char* name, uint16 defaultValue) const
{
uint16 value;
if (FindUInt16(name, &value) != B_OK)
return defaultValue;
return value;
}
int32
SettingsMessage::GetValue(const char* name, int32 defaultValue) const
{
@@ -389,6 +423,16 @@ SettingsMessage::GetValue(const char* name, int64 defaultValue) const
}
uint64
SettingsMessage::GetValue(const char* name, uint64 defaultValue) const
{
uint64 value;
if (FindUInt64(name, &value) != B_OK)
return defaultValue;
return value;
}
float
SettingsMessage::GetValue(const char* name, float defaultValue) const
{