mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-13 19:44:28 +00:00
common interator: add count() interface.
This commit is contained in:
parent
5b89389161
commit
2337ea2b01
3 changed files with 12 additions and 0 deletions
|
@ -31,6 +31,7 @@ namespace tvg
|
|||
{
|
||||
virtual ~Iterator() {}
|
||||
virtual const Paint* next() = 0;
|
||||
virtual uint32_t count() = 0;
|
||||
};
|
||||
|
||||
struct StrategyMethod
|
||||
|
|
|
@ -42,6 +42,12 @@ struct PictureIterator : Iterator
|
|||
paint = nullptr;
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint32_t count() override
|
||||
{
|
||||
if (paint) return 1;
|
||||
else return 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -43,6 +43,11 @@ struct SceneIterator : Iterator
|
|||
if (idx >= paints->count) return nullptr;
|
||||
return paints->data[idx++];
|
||||
}
|
||||
|
||||
uint32_t count() override
|
||||
{
|
||||
return paints->count;
|
||||
}
|
||||
};
|
||||
|
||||
struct Scene::Impl
|
||||
|
|
Loading…
Add table
Reference in a new issue