MCPcopy Create free account
hub / github.com/apache/arrow / operator()

Method operator()

cpp/src/arrow/util/reflection_test.cc:99–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97
98 template <typename Property>
99 void operator()(const Property& prop, size_t i) {
100 if (!obj_) return;
101
102 auto first_colon = members_[i].find_first_of(':');
103 if (first_colon == std::string_view::npos) return Fail();
104
105 auto name = members_[i].substr(0, first_colon);
106 if (name != prop.name()) return Fail();
107
108 auto value_repr = members_[i].substr(first_colon + 1);
109 typename Property::Type value;
110 try {
111 std::stringstream ss{std::string{value_repr}};
112 ss >> value;
113 if (!ss.eof()) return Fail();
114 } catch (...) {
115 return Fail();
116 }
117 prop.set(&*obj_, std::move(value));
118 }
119
120 std::optional<Class> obj_ = Class{};
121 std::vector<std::string_view> members_;

Callers

nothing calls this directly

Calls 3

substrMethod · 0.80
nameMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected