From f408e9c121bd91e4d284d9ca496a9bce4c2f9496 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 15 Sep 2020 03:01:06 +0200 Subject: DBTEnv: Resolve using environment vars under Unix shells, e.g. try 'direct_bt_debug' if ''direct_bt.debug' wasn't found. --- api/direct_bt/DBTEnv.hpp | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'api/direct_bt') diff --git a/api/direct_bt/DBTEnv.hpp b/api/direct_bt/DBTEnv.hpp index 7e63e917..99d5dc01 100644 --- a/api/direct_bt/DBTEnv.hpp +++ b/api/direct_bt/DBTEnv.hpp @@ -82,6 +82,15 @@ namespace direct_bt { *

* Note that only '[org.]tinyb.*' and 'direct_bt.*' Java JVM properties are passed via 'org.tinyb.BluetoothFactory' *

+ *

+ * Implementation attempts to also find a Unix conform environment name, + * e.g. 'direct_bt_debug' if ''direct_bt.debug' wasn't found.
+ * + * Dots are not allowed as valid Unix envrionment variable identifier. + * If the property 'name' isn't found and if the 'name' contains a dot ('.'), + * all dots ('.') will be replaced y underscore ('_') and looked up again.
+ * This allows Unix shell user to set the property 'direct_bt_debug' instead of 'direct_bt.debug'. + *

*/ static std::string getProperty(const std::string & name) noexcept; @@ -90,6 +99,8 @@ namespace direct_bt { * or the 'default_value' if the environment variable's value is null. *

* Implementation uses {@link #getProperty(const std::string & name)} + * and hence attempts to also find a Unix conform name, + * e.g. 'direct_bt_debug' if ''direct_bt.debug' wasn't found. *

*/ static std::string getProperty(const std::string & name, const std::string & default_value) noexcept; @@ -102,7 +113,9 @@ namespace direct_bt { * true is determined if the value equals 'true'. *

*

- * Implementation uses {@link #getProperty(const std::string & name)}. + * Implementation uses {@link #getProperty(const std::string & name)} + * and hence attempts to also find a Unix conform name, + * e.g. 'direct_bt_debug' if ''direct_bt.debug' wasn't found. *

*/ static bool getBooleanProperty(const std::string & name, const bool default_value) noexcept; @@ -113,6 +126,8 @@ namespace direct_bt { * or not within int32_t value range or within the given value range. *

* Implementation uses {@link #getProperty(const std::string & name)} + * and hence attempts to also find a Unix conform name, + * e.g. 'direct_bt_debug' if ''direct_bt.debug' wasn't found. *

*/ static int32_t getInt32Property(const std::string & name, const int32_t default_value, @@ -124,6 +139,8 @@ namespace direct_bt { * or not within uint32_t value range or within the given value range. *

* Implementation uses {@link #getProperty(const std::string & name)} + * and hence attempts to also find a Unix conform name, + * e.g. 'direct_bt_debug' if ''direct_bt.debug' wasn't found. *

*/ static uint32_t getUint32Property(const std::string & name, const uint32_t default_value, @@ -132,6 +149,11 @@ namespace direct_bt { /** * Fetches exploding variable-name (prefixDomain) values. *

+ * Implementation uses {@link #getProperty(const std::string & name)} + * and hence attempts to also find a Unix conform name, + * e.g. 'direct_bt_debug' if ''direct_bt.debug' wasn't found. + *

+ *

* If the value of a prefixDomain is neither 'true' or 'false', * it is treated as a list of sub-variable names including their optional value separated by comma ','. *

-- cgit v1.2.3