MCPcopy Create free account
hub / github.com/bytedance/sonic-cpp / Key

Method Key

include/sonic/dom/schema_handler.h:166–186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164 }
165
166 sonic_force_inline bool Key(StringView s) {
167 if (parent_node_ && parent_node_->IsObject()) {
168 if (found_node_count_ >= parent_node_->Size()) {
169 cur_node_ = nullptr;
170 return false;
171 }
172 auto m = parent_node_->FindMember(s);
173 if (m != parent_node_->MemberEnd()) {
174 cur_node_ = &(m->value);
175 found_node_count_++;
176 return true;
177 } else {
178 cur_node_ = nullptr;
179 return false;
180 }
181 }
182 // parent node ptr doesn't exist, we need save value into a new object.
183 // cur_node_ need to be set as nullptr!
184 cur_node_ = nullptr;
185 return stringImpl(s);
186 }
187
188 sonic_force_inline bool String(StringView s) {
189 if (cur_node_) {

Callers

nothing calls this directly

Calls 3

IsObjectMethod · 0.80
FindMemberMethod · 0.80
SizeMethod · 0.45

Tested by

no test coverage detected