Skip to content

Commit 53ac5aa

Browse files
author
Vladimir Paramuzov
committed
extended bool any parsing options
Signed-off-by: Vladimir Paramuzov <vladimir.paramuzov@intel.com>
1 parent 3ca210a commit 53ac5aa

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/core/src/any.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
#include <limits>
88
#include <string>
9+
#include "openvino/util/common_util.hpp"
910
namespace {
1011
template <class Container>
1112
bool contains_type_index(Container&& types, const std::type_info& user_type) {
@@ -200,9 +201,14 @@ namespace util {
200201
void Read<bool>::operator()(std::istream& is, bool& value) const {
201202
std::string str;
202203
is >> str;
203-
if (str == "YES") {
204+
205+
std::set<std::string> off = {"0", "false", "off", "no"};
206+
std::set<std::string> on = {"1", "true", "on", "yes"};
207+
str = util::to_lower(str);
208+
209+
if (on.count(str)) {
204210
value = true;
205-
} else if (str == "NO") {
211+
} else if (off.count(str)) {
206212
value = false;
207213
} else {
208214
OPENVINO_THROW("Could not convert to bool from string " + str);

0 commit comments

Comments
 (0)