MCPcopy Create free account
hub / github.com/couchbase/fleece / leafCount

Method leafCount

Fleece/Tree/MutableNode.hh:131–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

129
130
131 unsigned leafCount() const {
132 unsigned count = 0;
133 unsigned n = childCount();
134 for (unsigned i = 0; i < n; ++i) {
135 auto child = _children[i];
136 if (child.isMutable()) {
137 if (child.asMutable()->isLeaf())
138 count += 1;
139 else
140 count += ((MutableInterior*)child.asMutable())->leafCount();
141 } else {
142 if (child.asImmutable()->isLeaf())
143 count += 1;
144 else
145 count += child.asImmutable()->interior.leafCount();
146 }
147 }
148 return count;
149 }
150
151
152 NodeRef findNearest(hash_t hash) const {

Callers

nothing calls this directly

Calls 4

asImmutableMethod · 0.80
isMutableMethod · 0.45
isLeafMethod · 0.45
asMutableMethod · 0.45

Tested by

no test coverage detected