mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-15 12:34:30 +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 ~Iterator() {}
|
||||||
virtual const Paint* next() = 0;
|
virtual const Paint* next() = 0;
|
||||||
|
virtual uint32_t count() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct StrategyMethod
|
struct StrategyMethod
|
||||||
|
|
|
@ -42,6 +42,12 @@ struct PictureIterator : Iterator
|
||||||
paint = nullptr;
|
paint = nullptr;
|
||||||
return ret;
|
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;
|
if (idx >= paints->count) return nullptr;
|
||||||
return paints->data[idx++];
|
return paints->data[idx++];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t count() override
|
||||||
|
{
|
||||||
|
return paints->count;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Scene::Impl
|
struct Scene::Impl
|
||||||
|
|
Loading…
Add table
Reference in a new issue