Albert Astals Cid <[email protected]> writes:
> And it's not like they are saving us much typing
> arrayGetLength()
> turns into
> getArray()->getLength()
This sounds reasonable to me. The most common use in the Poppler code is
iterating through the items in an array, in which case turning the loop
into something like:
auto array = whateverObj.getArray();
for (int i = 0; i < array->getLength(); ++i) {
... array->get(i) ...
}
also potentially saves doing the OBJECT_TYPE check twice for each
iteration of the loop, and would make it easier to convert to range-for
loop form in the future.
There are also 70-odd tests like:
if (obj1.isArray() && obj1.arrayGetLength() == 2)
How about adding Object::isArrayWithLength(int n) for these?
(xpopple had one use of arrayGet/arrayGetLength, which I've just
removed.)
Thanks,
--
Adam Sampson <[email protected]> <http://offog.org/>