Merge pull request #14097 from TheCodez/patch-1

Add missing getChildByTag<>() api
This commit is contained in:
pandamicro 2015-10-10 09:43:46 +08:00
commit ee3399a4a4
1 changed files with 11 additions and 0 deletions

View File

@ -769,6 +769,17 @@ public:
* Please use `getChildByName()` instead.
*/
virtual Node * getChildByTag(int tag) const;
/**
* Gets a child from the container with its tag that can be cast to Type T.
*
* @param tag An identifier to find the child node.
*
* @return a Node with the given tag that can be cast to Type T.
*/
template <typename T>
inline T getChildByTag(int tag) const { return static_cast<T>(getChildByTag(tag)); }
/**
* Gets a child from the container with its name.
*