Skip to content

Commit

Permalink
change ‘auto’ to ‘auto&&’
Browse files Browse the repository at this point in the history
  • Loading branch information
WenhaiLin committed Jul 16, 2015
1 parent 1c9a181 commit d5d5af5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
28 changes: 14 additions & 14 deletions cocos/2d/CCLabel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ Label::Label(TextHAlignment hAlignment /* = TextHAlignment::LEFT */,
_purgeTextureListener = EventListenerCustom::create(FontAtlas::CMD_PURGE_FONTATLAS, [this](EventCustom* event){
if (_fontAtlas && _currentLabelType == LabelType::TTF && event->getUserData() == _fontAtlas)
{
for (auto it : _letters)
for (auto&& it : _letters)
{
it.second->setTexture(nullptr);
}
Expand All @@ -361,7 +361,7 @@ Label::Label(TextHAlignment hAlignment /* = TextHAlignment::LEFT */,
{
_fontAtlas = nullptr;
this->setTTFConfig(_fontConfig);
for (auto it : _letters)
for (auto&& it : _letters)
{
getLetter(it.first);
}
Expand Down Expand Up @@ -756,7 +756,7 @@ void Label::alignText()
}
}

for (const auto& batchNode : _batchNodes)
for (auto&& batchNode : _batchNodes)
{
batchNode->getTextureAtlas()->removeAllQuads();
}
Expand Down Expand Up @@ -1157,11 +1157,11 @@ void Label::onDrawShadow(GLProgram* glProgram)
}

glProgram->setUniformsForBuiltins(_shadowTransform);
for (auto it : _letters)
for (auto&& it : _letters)
{
it.second->updateTransform();
}
for (const auto& batchNode : _batchNodes)
for (auto&& batchNode : _batchNodes)
{
batchNode->getTextureAtlas()->drawQuads();
}
Expand All @@ -1174,11 +1174,11 @@ void Label::onDrawShadow(GLProgram* glProgram)
setColor(_shadowColor3B);

glProgram->setUniformsForBuiltins(_shadowTransform);
for (auto it : _letters)
for (auto&& it : _letters)
{
it.second->updateTransform();
}
for (const auto& batchNode : _batchNodes)
for (auto&& batchNode : _batchNodes)
{
batchNode->getTextureAtlas()->drawQuads();
}
Expand All @@ -1200,7 +1200,7 @@ void Label::onDraw(const Mat4& transform, bool transformUpdated)
}

glprogram->setUniformsForBuiltins(transform);
for (auto it : _letters)
for (auto&& it : _letters)
{
it.second->updateTransform();
}
Expand All @@ -1214,7 +1214,7 @@ void Label::onDraw(const Mat4& transform, bool transformUpdated)
_textColorF.r, _textColorF.g, _textColorF.b, _textColorF.a);
glprogram->setUniformLocationWith4f(_uniformEffectColor,
_effectColorF.r, _effectColorF.g, _effectColorF.b, _effectColorF.a);
for (const auto& batchNode : _batchNodes)
for (auto&& batchNode : _batchNodes)
{
batchNode->getTextureAtlas()->drawQuads();
}
Expand All @@ -1235,7 +1235,7 @@ void Label::onDraw(const Mat4& transform, bool transformUpdated)
}
}

for (const auto& batchNode : _batchNodes)
for (auto&& batchNode : _batchNodes)
{
batchNode->getTextureAtlas()->drawQuads();
}
Expand Down Expand Up @@ -1526,7 +1526,7 @@ void Label::updateDisplayedColor(const Color3B& parentColor)
}
}

for (auto it : _letters)
for (auto&& it : _letters)
{
it.second->updateDisplayedColor(_displayedColor);;
}
Expand All @@ -1545,7 +1545,7 @@ void Label::updateDisplayedOpacity(GLubyte parentOpacity)
}
}

for (auto it : _letters)
for (auto&& it : _letters)
{
it.second->updateDisplayedOpacity(_displayedOpacity);;
}
Expand Down Expand Up @@ -1586,7 +1586,7 @@ void Label::updateColor()

cocos2d::TextureAtlas* textureAtlas;
V3F_C4B_T2F_Quad *quads;
for (const auto& batchNode:_batchNodes)
for (auto&& batchNode:_batchNodes)
{
textureAtlas = batchNode->getTextureAtlas();
quads = textureAtlas->getQuads();
Expand Down Expand Up @@ -1649,7 +1649,7 @@ void Label::removeAllChildrenWithCleanup(bool cleanup)
void Label::removeChild(Node* child, bool cleanup /* = true */)
{
Node::removeChild(child, cleanup);
for (auto it : _letters)
for (auto&& it : _letters)
{
if (it.second == child)
{
Expand Down
4 changes: 2 additions & 2 deletions tests/cpp-tests/Classes/LabelTest/LabelTestNew.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1555,7 +1555,7 @@ void LabelAlignmentTest::setAlignmentBottom(Ref* sender)
_label->setString(getCurrentAlignment());
}

const char* LabelAlignmentTest::getCurrentAlignment()
std::string LabelAlignmentTest::getCurrentAlignment()
{
const char* vertical = nullptr;
const char* horizontal = nullptr;
Expand All @@ -1582,7 +1582,7 @@ const char* LabelAlignmentTest::getCurrentAlignment()
break;
}

return StringUtils::format("Alignment %s %s", vertical, horizontal).c_str();
return StringUtils::format("Alignment %s %s", vertical, horizontal);
}

std::string LabelAlignmentTest::title() const
Expand Down
2 changes: 1 addition & 1 deletion tests/cpp-tests/Classes/LabelTest/LabelTestNew.h
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ class LabelAlignmentTest : public AtlasDemoNew
void setAlignmentTop(cocos2d::Ref* sender);
void setAlignmentMiddle(cocos2d::Ref* sender);
void setAlignmentBottom(cocos2d::Ref* sender);
const char* getCurrentAlignment();
std::string getCurrentAlignment();

cocos2d::Label* _label;
cocos2d::TextHAlignment _horizAlign;
Expand Down

0 comments on commit d5d5af5

Please sign in to comment.