diff options
author | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-04-05 20:01:10 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-04-05 20:01:10 +0200 |
commit | c3b63b831cd2c64700e875b28540212c7c881ac6 (patch) | |
tree | edd98fcbd2004d3b562904f822bf6c3322fc7f52 /modules/libpref/nsPrefBranch.cpp | |
parent | d432e068a21c815d5d5e7bcbc1cc8c6e77a7d1e0 (diff) | |
parent | cc07da9cb4d6e7a53f8d953427ffc2bca2e0c2df (diff) | |
download | UXP-c3b63b831cd2c64700e875b28540212c7c881ac6.tar UXP-c3b63b831cd2c64700e875b28540212c7c881ac6.tar.gz UXP-c3b63b831cd2c64700e875b28540212c7c881ac6.tar.lz UXP-c3b63b831cd2c64700e875b28540212c7c881ac6.tar.xz UXP-c3b63b831cd2c64700e875b28540212c7c881ac6.zip |
Merge branch 'master' into 816
Diffstat (limited to 'modules/libpref/nsPrefBranch.cpp')
-rw-r--r-- | modules/libpref/nsPrefBranch.cpp | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/modules/libpref/nsPrefBranch.cpp b/modules/libpref/nsPrefBranch.cpp index 98e06aaa4..5173db06e 100644 --- a/modules/libpref/nsPrefBranch.cpp +++ b/modules/libpref/nsPrefBranch.cpp @@ -141,6 +141,20 @@ NS_IMETHODIMP nsPrefBranch::GetPrefType(const char *aPrefName, int32_t *_retval) return NS_OK; } +NS_IMETHODIMP nsPrefBranch::GetBoolPrefWithDefault(const char *aPrefName, + bool aDefaultValue, + uint8_t _argc, bool *_retval) +{ + nsresult rv = GetBoolPref(aPrefName, _retval); + + if (NS_FAILED(rv) && _argc == 1) { + *_retval = aDefaultValue; + return NS_OK; + } + + return rv; +} + NS_IMETHODIMP nsPrefBranch::GetBoolPref(const char *aPrefName, bool *_retval) { NS_ENSURE_ARG(aPrefName); @@ -156,6 +170,20 @@ NS_IMETHODIMP nsPrefBranch::SetBoolPref(const char *aPrefName, bool aValue) return PREF_SetBoolPref(pref, aValue, mIsDefault); } +NS_IMETHODIMP nsPrefBranch::GetFloatPrefWithDefault(const char *aPrefName, + float aDefaultValue, + uint8_t _argc, float *_retval) +{ + nsresult rv = GetFloatPref(aPrefName, _retval); + + if (NS_FAILED(rv) && _argc == 1) { + *_retval = aDefaultValue; + return NS_OK; + } + + return rv; +} + NS_IMETHODIMP nsPrefBranch::GetFloatPref(const char *aPrefName, float *_retval) { NS_ENSURE_ARG(aPrefName); @@ -169,6 +197,21 @@ NS_IMETHODIMP nsPrefBranch::GetFloatPref(const char *aPrefName, float *_retval) return rv; } +NS_IMETHODIMP nsPrefBranch::GetCharPrefWithDefault(const char *aPrefName, + const char *aDefaultValue, + uint8_t _argc, char **_retval) +{ + nsresult rv = GetCharPref(aPrefName, _retval); + + if (NS_FAILED(rv) && _argc == 1) { + NS_ENSURE_ARG(aDefaultValue); + *_retval = NS_strdup(aDefaultValue); + return NS_OK; + } + + return rv; +} + NS_IMETHODIMP nsPrefBranch::GetCharPref(const char *aPrefName, char **_retval) { NS_ENSURE_ARG(aPrefName); @@ -195,6 +238,20 @@ nsresult nsPrefBranch::SetCharPrefInternal(const char *aPrefName, const char *aV return PREF_SetCharPref(pref, aValue, mIsDefault); } +NS_IMETHODIMP nsPrefBranch::GetIntPrefWithDefault(const char *aPrefName, + int32_t aDefaultValue, + uint8_t _argc, int32_t *_retval) +{ + nsresult rv = GetIntPref(aPrefName, _retval); + + if (NS_FAILED(rv) && _argc == 1) { + *_retval = aDefaultValue; + return NS_OK; + } + + return rv; +} + NS_IMETHODIMP nsPrefBranch::GetIntPref(const char *aPrefName, int32_t *_retval) { NS_ENSURE_ARG(aPrefName); |