MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / parse

Method parse

utils/command_line/EnumListOption.h:90–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88
89template <typename T>
90bool EnumListOption<T>::parse(std::string value)
91{
92 // Remove default values
93 _values.clear();
94 _is_set = true;
95
96 std::stringstream stream{value};
97 std::string item;
98
99 while (!std::getline(stream, item, ',').fail())
100 {
101 try
102 {
103 std::stringstream item_stream(item);
104 T typed_value{};
105
106 item_stream >> typed_value;
107
108 if (!item_stream.fail())
109 {
110 if (_allowed_values.count(typed_value) == 0)
111 {
112 _is_set = false;
113 continue;
114 }
115
116 _values.emplace_back(typed_value);
117 }
118
119 _is_set = _is_set && !item_stream.fail();
120 }
121 catch (const std::invalid_argument &)
122 {
123 _is_set = false;
124 }
125 }
126
127 return _is_set;
128}
129
130template <typename T>
131std::string EnumListOption<T>::help() const

Callers

nothing calls this directly

Calls 1

clearMethod · 0.45

Tested by

no test coverage detected