From 1c6c13b3e528450dd69c58b13047e599cd723c51 Mon Sep 17 00:00:00 2001 From: Xavier Arias Date: Thu, 9 May 2013 00:20:08 +0200 Subject: [PATCH 1/3] Added const to CCNode's getTag & getContentSize --- cocos2dx/base_nodes/CCNode.cpp | 4 ++-- cocos2dx/base_nodes/CCNode.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cocos2dx/base_nodes/CCNode.cpp b/cocos2dx/base_nodes/CCNode.cpp index 31aed1c1ef..15dc4a609d 100644 --- a/cocos2dx/base_nodes/CCNode.cpp +++ b/cocos2dx/base_nodes/CCNode.cpp @@ -392,7 +392,7 @@ void CCNode::setAnchorPoint(const CCPoint& point) } /// contentSize getter -const CCSize& CCNode::getContentSize() +const CCSize& CCNode::getContentSize() const { return m_obContentSize; } @@ -441,7 +441,7 @@ void CCNode::ignoreAnchorPointForPosition(bool newValue) } /// tag getter -int CCNode::getTag() +int CCNode::getTag() const { return m_nTag; } diff --git a/cocos2dx/base_nodes/CCNode.h b/cocos2dx/base_nodes/CCNode.h index 1ecb0fa412..6a9b179f50 100644 --- a/cocos2dx/base_nodes/CCNode.h +++ b/cocos2dx/base_nodes/CCNode.h @@ -412,7 +412,7 @@ public: * * @return The untransformed size of the node. */ - virtual const CCSize& getContentSize(); + virtual const CCSize& getContentSize() const; /** @@ -757,7 +757,7 @@ public: * * @return A interger that identifies the node. */ - virtual int getTag(); + virtual int getTag() const; /** * Changes the tag that is used to identify the node easily. * From 71df5706bdfabf45fbc2c67b2781bd603e7ba08f Mon Sep 17 00:00:00 2001 From: Xavier Arias Date: Sun, 12 May 2013 20:45:41 +0200 Subject: [PATCH 2/3] Added const to CCNode::getChildrenCount() --- cocos2dx/base_nodes/CCNode.cpp | 2 +- cocos2dx/base_nodes/CCNode.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cocos2dx/base_nodes/CCNode.cpp b/cocos2dx/base_nodes/CCNode.cpp index 15dc4a609d..19b1c1239a 100644 --- a/cocos2dx/base_nodes/CCNode.cpp +++ b/cocos2dx/base_nodes/CCNode.cpp @@ -326,7 +326,7 @@ CCArray* CCNode::getChildren() return m_pChildren; } -unsigned int CCNode::getChildrenCount(void) +unsigned int CCNode::getChildrenCount(void) const { return m_pChildren ? m_pChildren->count() : 0; } diff --git a/cocos2dx/base_nodes/CCNode.h b/cocos2dx/base_nodes/CCNode.h index 6a9b179f50..75c72dc59b 100644 --- a/cocos2dx/base_nodes/CCNode.h +++ b/cocos2dx/base_nodes/CCNode.h @@ -608,7 +608,7 @@ public: * * @return The amount of children. */ - unsigned int getChildrenCount(void); + unsigned int getChildrenCount(void) const; /** * Sets the parent node From c0a6f0c74f3922779ee3d08d6fadc2e2c176322c Mon Sep 17 00:00:00 2001 From: James Chen Date: Mon, 13 May 2013 15:07:47 +0800 Subject: [PATCH 3/3] fixed #2149: "const CCSize& CCScrollView::getContentSize()" --> "const CCSize& CCScrollView::getContentSize() const". --- extensions/GUI/CCScrollView/CCScrollView.cpp | 2 +- extensions/GUI/CCScrollView/CCScrollView.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/GUI/CCScrollView/CCScrollView.cpp b/extensions/GUI/CCScrollView/CCScrollView.cpp index 24b450c618..b27b375f8a 100644 --- a/extensions/GUI/CCScrollView/CCScrollView.cpp +++ b/extensions/GUI/CCScrollView/CCScrollView.cpp @@ -436,7 +436,7 @@ void CCScrollView::performedAnimatedScroll(float dt) } -const CCSize& CCScrollView::getContentSize() +const CCSize& CCScrollView::getContentSize() const { return m_pContainer->getContentSize(); } diff --git a/extensions/GUI/CCScrollView/CCScrollView.h b/extensions/GUI/CCScrollView/CCScrollView.h index 00602374ac..23cf2a9e2a 100644 --- a/extensions/GUI/CCScrollView/CCScrollView.h +++ b/extensions/GUI/CCScrollView/CCScrollView.h @@ -187,7 +187,7 @@ public: virtual void ccTouchCancelled(CCTouch *pTouch, CCEvent *pEvent); virtual void setContentSize(const CCSize & size); - virtual const CCSize& getContentSize(); + virtual const CCSize& getContentSize() const; void updateInset(); /**