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

Method leafCount

Fleece/Tree/HashTree.cc:108–118  ·  view source on GitHub ↗

Returns the total number of leaves under this node.

Source from the content-addressed store, hash-verified

106
107 // Returns the total number of leaves under this node.
108 unsigned Interior::leafCount() const {
109 unsigned count = 0;
110 auto c = childAtIndex(0);
111 for (unsigned n = childCount(); n > 0; --n, ++c) {
112 if (c->isLeaf())
113 count += 1;
114 else
115 count += ((Interior*)c)->leafCount();
116 }
117 return count;
118 }
119
120 void Interior::dump(std::ostream &out, unsigned indent =1) const {
121 unsigned n = childCount();

Callers 2

countMethod · 0.45
countMethod · 0.45

Calls 1

isLeafMethod · 0.45

Tested by

no test coverage detected