From d1b555614ede6701e5293eab5a644759fb7a032e Mon Sep 17 00:00:00 2001 From: Ricardo Quesada Date: Wed, 18 Dec 2013 11:45:30 -0800 Subject: [PATCH] removes `using namespace std` from header file ... in order to prevent possible collisions. `using namespace XXX` MUST never be used in header files. --- .../cocostudio/CCSpriteFrameCacheHelper.h | 2 - .../Classes/ActionsTest/ActionsTest.cpp | 16 ++--- .../Classes/FileUtilsTest/FileUtilsTest.cpp | 42 +++++++------- .../Classes/FileUtilsTest/FileUtilsTest.h | 33 +++++------ .../TestCpp/Classes/InputTest/MouseTest.cpp | 10 ++-- .../TestCpp/Classes/LabelTest/LabelTest.cpp | 16 ++--- .../Classes/LabelTest/LabelTestNew.cpp | 10 ++-- .../TestCpp/Classes/LayerTest/LayerTest.cpp | 12 ++-- .../NewEventDispatcherTest.cpp | 4 +- .../NewRendererTest/NewRendererTest.cpp | 31 +++++----- .../Classes/NewRendererTest/NewRendererTest.h | 28 +++++---- .../RenderTextureTest/RenderTextureTest.cpp | 12 ++-- .../TestCpp/Classes/ShaderTest/ShaderTest.cpp | 4 +- .../SpriteTest/SpriteTest.cpp.REMOVED.git-id | 2 +- .../Classes/Texture2dTest/Texture2dTest.cpp | 58 +++++++++---------- .../Classes/TileMapTest/TileMapTest.cpp | 12 ++-- .../UserDefaultTest/UserDefaultTest.cpp | 2 +- samples/Cpp/TestCpp/Classes/testBasic.h | 2 - 18 files changed, 144 insertions(+), 152 deletions(-) diff --git a/cocos/editor-support/cocostudio/CCSpriteFrameCacheHelper.h b/cocos/editor-support/cocostudio/CCSpriteFrameCacheHelper.h index f24f7bbee4..60f7c85fda 100644 --- a/cocos/editor-support/cocostudio/CCSpriteFrameCacheHelper.h +++ b/cocos/editor-support/cocostudio/CCSpriteFrameCacheHelper.h @@ -27,8 +27,6 @@ THE SOFTWARE. #include "cocostudio/CCArmatureDefine.h" #include -using namespace std; - namespace cocostudio { /** diff --git a/samples/Cpp/TestCpp/Classes/ActionsTest/ActionsTest.cpp b/samples/Cpp/TestCpp/Classes/ActionsTest/ActionsTest.cpp index cde2c87f2c..c75bc87fbf 100644 --- a/samples/Cpp/TestCpp/Classes/ActionsTest/ActionsTest.cpp +++ b/samples/Cpp/TestCpp/Classes/ActionsTest/ActionsTest.cpp @@ -316,7 +316,7 @@ void ActionSkew::onEnter() _kathia->runAction(Sequence::create(actionBy2, actionBy2->reverse(), NULL)); } -string ActionSkew::subtitle() +std::string ActionSkew::subtitle() { return "SkewTo / SkewBy"; } @@ -438,7 +438,7 @@ void ActionSkewRotateScale::onEnter() box->runAction(Sequence::create(actionScaleTo, actionScaleToBack, NULL)); } -string ActionSkewRotateScale::subtitle() +std::string ActionSkewRotateScale::subtitle() { return "Skew + Rotate + Scale"; } @@ -2040,12 +2040,12 @@ void ActionCatmullRom::draw() DrawPrimitives::drawCatmullRom(_array2,50); } -string ActionCatmullRom::title() +std::string ActionCatmullRom::title() { return "CatmullRomBy / CatmullRomTo"; } -string ActionCatmullRom::subtitle() +std::string ActionCatmullRom::subtitle() { return "Catmull Rom spline paths. Testing reverse too"; } @@ -2123,12 +2123,12 @@ void ActionCardinalSpline::draw() kmGLPopMatrix(); } -string ActionCardinalSpline::title() +std::string ActionCardinalSpline::title() { return "CardinalSplineBy / CardinalSplineTo"; } -string ActionCardinalSpline::subtitle() +std::string ActionCardinalSpline::subtitle() { return "Cardinal Spline paths. Testing different tensions for one array"; } @@ -2160,12 +2160,12 @@ void PauseResumeActions::onEnter() this->schedule(schedule_selector(PauseResumeActions::resume), 5, false, 0); } -string PauseResumeActions::title() +std::string PauseResumeActions::title() { return "PauseResumeActions"; } -string PauseResumeActions::subtitle() +std::string PauseResumeActions::subtitle() { return "All actions pause at 3s and resume at 5s"; } diff --git a/samples/Cpp/TestCpp/Classes/FileUtilsTest/FileUtilsTest.cpp b/samples/Cpp/TestCpp/Classes/FileUtilsTest/FileUtilsTest.cpp index 0433711a73..56410240f8 100644 --- a/samples/Cpp/TestCpp/Classes/FileUtilsTest/FileUtilsTest.cpp +++ b/samples/Cpp/TestCpp/Classes/FileUtilsTest/FileUtilsTest.cpp @@ -82,12 +82,12 @@ void FileUtilsDemo::restartCallback(Object* sender) scene->release(); } -string FileUtilsDemo::title() +std::string FileUtilsDemo::title() { return "No title"; } -string FileUtilsDemo::subtitle() +std::string FileUtilsDemo::subtitle() { return ""; } @@ -99,16 +99,16 @@ void TestResolutionDirectories::onEnter() FileUtilsDemo::onEnter(); auto sharedFileUtils = FileUtils::getInstance(); - string ret; + std::string ret; sharedFileUtils->purgeCachedEntries(); _defaultSearchPathArray = sharedFileUtils->getSearchPaths(); - vector searchPaths = _defaultSearchPathArray; + std::vector searchPaths = _defaultSearchPathArray; searchPaths.insert(searchPaths.begin(), "Misc"); sharedFileUtils->setSearchPaths(searchPaths); _defaultResolutionsOrderArray = sharedFileUtils->getSearchResolutionsOrder(); - vector resolutionsOrder = _defaultResolutionsOrderArray; + std::vector resolutionsOrder = _defaultResolutionsOrderArray; resolutionsOrder.insert(resolutionsOrder.begin(), "resources-ipadhd"); resolutionsOrder.insert(resolutionsOrder.begin()+1, "resources-ipad"); @@ -136,12 +136,12 @@ void TestResolutionDirectories::onExit() FileUtilsDemo::onExit(); } -string TestResolutionDirectories::title() +std::string TestResolutionDirectories::title() { return "FileUtils: resolutions in directories"; } -string TestResolutionDirectories::subtitle() +std::string TestResolutionDirectories::subtitle() { return "See the console"; } @@ -153,13 +153,13 @@ void TestSearchPath::onEnter() FileUtilsDemo::onEnter(); auto sharedFileUtils = FileUtils::getInstance(); - string ret; + std::string ret; sharedFileUtils->purgeCachedEntries(); _defaultSearchPathArray = sharedFileUtils->getSearchPaths(); - vector searchPaths = _defaultSearchPathArray; - string writablePath = sharedFileUtils->getWritablePath(); - string fileName = writablePath+"external.txt"; + std::vector searchPaths = _defaultSearchPathArray; + std::string writablePath = sharedFileUtils->getWritablePath(); + std::string fileName = writablePath+"external.txt"; char szBuf[100] = "Hello Cocos2d-x!"; FILE* fp = fopen(fileName.c_str(), "wb"); if (fp) @@ -177,7 +177,7 @@ void TestSearchPath::onEnter() sharedFileUtils->setSearchPaths(searchPaths); _defaultResolutionsOrderArray = sharedFileUtils->getSearchResolutionsOrder(); - vector resolutionsOrder = _defaultResolutionsOrderArray; + std::vector resolutionsOrder = _defaultResolutionsOrderArray; resolutionsOrder.insert(resolutionsOrder.begin(), "resources-ipad"); sharedFileUtils->setSearchResolutionsOrder(resolutionsOrder); @@ -189,7 +189,7 @@ void TestSearchPath::onEnter() } // Gets external.txt from writable path - string fullPath = sharedFileUtils->fullPathForFilename("external.txt"); + std::string fullPath = sharedFileUtils->fullPathForFilename("external.txt"); log("external file path = %s", fullPath.c_str()); if (fullPath.length() > 0) { @@ -215,12 +215,12 @@ void TestSearchPath::onExit() FileUtilsDemo::onExit(); } -string TestSearchPath::title() +std::string TestSearchPath::title() { return "FileUtils: search path"; } -string TestSearchPath::subtitle() +std::string TestSearchPath::subtitle() { return "See the console"; } @@ -258,12 +258,12 @@ void TestFilenameLookup::onExit() FileUtilsDemo::onExit(); } -string TestFilenameLookup::title() +std::string TestFilenameLookup::title() { return "FileUtils: filename lookup"; } -string TestFilenameLookup::subtitle() +std::string TestFilenameLookup::subtitle() { return "See the console"; } @@ -302,12 +302,12 @@ void TestIsFileExist::onExit() FileUtilsDemo::onExit(); } -string TestIsFileExist::title() +std::string TestIsFileExist::title() { return "FileUtils: check whether the file exists"; } -string TestIsFileExist::subtitle() +std::string TestIsFileExist::subtitle() { return ""; } @@ -361,12 +361,12 @@ void TextWritePlist::onExit() FileUtilsDemo::onExit(); } -string TextWritePlist::title() +std::string TextWritePlist::title() { return "FileUtils: Dictionary to plist"; } -string TextWritePlist::subtitle() +std::string TextWritePlist::subtitle() { std::string writablePath = FileUtils::getInstance()->getWritablePath().c_str(); return ("See plist file at your writablePath"); diff --git a/samples/Cpp/TestCpp/Classes/FileUtilsTest/FileUtilsTest.h b/samples/Cpp/TestCpp/Classes/FileUtilsTest/FileUtilsTest.h index 93d1a98df2..c7188e032e 100644 --- a/samples/Cpp/TestCpp/Classes/FileUtilsTest/FileUtilsTest.h +++ b/samples/Cpp/TestCpp/Classes/FileUtilsTest/FileUtilsTest.h @@ -5,7 +5,6 @@ #include "../BaseTest.h" USING_NS_CC; -using namespace std; class FileUtilsTestScene : public TestScene { @@ -17,8 +16,8 @@ class FileUtilsDemo : public BaseTest { public: virtual void onEnter(); - virtual string title(); - virtual string subtitle(); + virtual std::string title(); + virtual std::string subtitle(); void backCallback(Object* sender); void nextCallback(Object* sender); void restartCallback(Object* sender); @@ -31,11 +30,11 @@ public: virtual void onEnter(); virtual void onExit(); - virtual string title(); - virtual string subtitle(); + virtual std::string title(); + virtual std::string subtitle(); private: - vector _defaultSearchPathArray; - vector _defaultResolutionsOrderArray; + std::vector _defaultSearchPathArray; + std::vector _defaultResolutionsOrderArray; }; class TestSearchPath : public FileUtilsDemo @@ -45,11 +44,11 @@ public: virtual void onEnter(); virtual void onExit(); - virtual string title(); - virtual string subtitle(); + virtual std::string title(); + virtual std::string subtitle(); private: - vector _defaultSearchPathArray; - vector _defaultResolutionsOrderArray; + std::vector _defaultSearchPathArray; + std::vector _defaultResolutionsOrderArray; }; class TestFilenameLookup : public FileUtilsDemo @@ -59,8 +58,8 @@ public: virtual void onEnter(); virtual void onExit(); - virtual string title(); - virtual string subtitle(); + virtual std::string title(); + virtual std::string subtitle(); }; class TestIsFileExist : public FileUtilsDemo @@ -70,8 +69,8 @@ public: virtual void onEnter(); virtual void onExit(); - virtual string title(); - virtual string subtitle(); + virtual std::string title(); + virtual std::string subtitle(); }; class TextWritePlist : public FileUtilsDemo @@ -81,8 +80,8 @@ public: virtual void onEnter(); virtual void onExit(); - virtual string title(); - virtual string subtitle(); + virtual std::string title(); + virtual std::string subtitle(); }; #endif /* __FILEUTILSTEST_H__ */ diff --git a/samples/Cpp/TestCpp/Classes/InputTest/MouseTest.cpp b/samples/Cpp/TestCpp/Classes/InputTest/MouseTest.cpp index 01e5cdd746..4084243f38 100644 --- a/samples/Cpp/TestCpp/Classes/InputTest/MouseTest.cpp +++ b/samples/Cpp/TestCpp/Classes/InputTest/MouseTest.cpp @@ -38,12 +38,12 @@ MouseTest::~MouseTest() _labelPosition->release(); } -template string tostr(const T& t) { ostringstream os; os< std::string tostr(const T& t) { std::ostringstream os; os<getMouseButton()); _labelAction->setString(str.c_str()); } @@ -51,7 +51,7 @@ void MouseTest::onMouseDown(Event *event) void MouseTest::onMouseUp(Event *event) { EventMouse* e = (EventMouse*)event; - string str = "Mouse Up detected, Key: "; + std::string str = "Mouse Up detected, Key: "; str += tostr(e->getMouseButton()); _labelAction->setString(str.c_str()); } @@ -59,7 +59,7 @@ void MouseTest::onMouseUp(Event *event) void MouseTest::onMouseMove(Event *event) { EventMouse* e = (EventMouse*)event; - string str = "MousePosition X:"; + std::string str = "MousePosition X:"; str = str + tostr(e->getCursorX()) + " Y:" + tostr(e->getCursorY()); _labelPosition->setString(str.c_str()); } @@ -67,7 +67,7 @@ void MouseTest::onMouseMove(Event *event) void MouseTest::onMouseScroll(Event *event) { EventMouse* e = (EventMouse*)event; - string str = "Mouse Scroll detected, X: "; + std::string str = "Mouse Scroll detected, X: "; str = str + tostr(e->getScrollX()) + " Y: " + tostr(e->getScrollY()); _labelAction->setString(str.c_str()); } diff --git a/samples/Cpp/TestCpp/Classes/LabelTest/LabelTest.cpp b/samples/Cpp/TestCpp/Classes/LabelTest/LabelTest.cpp index 6681c3eab3..90767fe723 100644 --- a/samples/Cpp/TestCpp/Classes/LabelTest/LabelTest.cpp +++ b/samples/Cpp/TestCpp/Classes/LabelTest/LabelTest.cpp @@ -1046,12 +1046,12 @@ const char* LabelTTFTest::getCurrentAlignment() return String::createWithFormat("Alignment %s %s", vertical, horizontal)->getCString(); } -string LabelTTFTest::title() +std::string LabelTTFTest::title() { return "Testing LabelTTF"; } -string LabelTTFTest::subtitle() +std::string LabelTTFTest::subtitle() { return "Select the buttons on the sides to change alignment"; } @@ -1072,12 +1072,12 @@ LabelTTFMultiline::LabelTTFMultiline() addChild(center); } -string LabelTTFMultiline::title() +std::string LabelTTFMultiline::title() { return "Testing LabelTTF Word Wrap"; } -string LabelTTFMultiline::subtitle() +std::string LabelTTFMultiline::subtitle() { return "Word wrap using LabelTTF and a custom TTF font"; } @@ -1090,7 +1090,7 @@ LabelTTFChinese::LabelTTFChinese() this->addChild(label); } -string LabelTTFChinese::title() +std::string LabelTTFChinese::title() { return "Testing LabelTTF with Chinese character"; } @@ -1103,7 +1103,7 @@ LabelBMFontChinese::LabelBMFontChinese() this->addChild(label); } -string LabelBMFontChinese::title() +std::string LabelBMFontChinese::title() { return "Testing LabelBMFont with Chinese character"; } @@ -1583,12 +1583,12 @@ LabelBMFontBounds::LabelBMFontBounds() label1->setPosition(Point(s.width/2, s.height/2)); } -string LabelBMFontBounds::title() +std::string LabelBMFontBounds::title() { return "Testing LabelBMFont Bounds"; } -string LabelBMFontBounds::subtitle() +std::string LabelBMFontBounds::subtitle() { return "You should see string enclosed by a box"; } diff --git a/samples/Cpp/TestCpp/Classes/LabelTest/LabelTestNew.cpp b/samples/Cpp/TestCpp/Classes/LabelTest/LabelTestNew.cpp index 305989cdc6..5924a45aac 100644 --- a/samples/Cpp/TestCpp/Classes/LabelTest/LabelTestNew.cpp +++ b/samples/Cpp/TestCpp/Classes/LabelTest/LabelTestNew.cpp @@ -599,7 +599,7 @@ std::string LabelTTFUnicodeChinese::title() return "New Label + .TTF file Chinese"; } -string LabelTTFUnicodeChinese::subtitle() +std::string LabelTTFUnicodeChinese::subtitle() { return "Testing new Label + TTF with Chinese character"; } @@ -613,12 +613,12 @@ LabelFNTUnicodeChinese::LabelFNTUnicodeChinese() this->addChild(label); } -string LabelFNTUnicodeChinese::title() +std::string LabelFNTUnicodeChinese::title() { return "New Label + .FNT file Chinese"; } -string LabelFNTUnicodeChinese::subtitle() +std::string LabelFNTUnicodeChinese::subtitle() { return "Testing new Label + FNT with Chinese character"; } @@ -885,12 +885,12 @@ LabelFNTBounds::LabelFNTBounds() label1->setPosition(Point(s.width/2, s.height/2)); } -string LabelFNTBounds::title() +std::string LabelFNTBounds::title() { return "New Label + .FNT + Bounds"; } -string LabelFNTBounds::subtitle() +std::string LabelFNTBounds::subtitle() { return "You should see string enclosed by a box"; } diff --git a/samples/Cpp/TestCpp/Classes/LayerTest/LayerTest.cpp b/samples/Cpp/TestCpp/Classes/LayerTest/LayerTest.cpp index d9149fed6d..81d0b463db 100644 --- a/samples/Cpp/TestCpp/Classes/LayerTest/LayerTest.cpp +++ b/samples/Cpp/TestCpp/Classes/LayerTest/LayerTest.cpp @@ -68,7 +68,7 @@ LayerTest::~LayerTest(void) { } -string LayerTest::subtitle() +std::string LayerTest::subtitle() { return ""; } @@ -626,7 +626,7 @@ std::string LayerGradientTest::title() return "LayerGradientTest"; } -string LayerGradientTest::subtitle() +std::string LayerGradientTest::subtitle() { return "Touch the screen and move your finger"; } @@ -649,7 +649,7 @@ std::string LayerGradientTest2::title() return "LayerGradientTest 2"; } -string LayerGradientTest2::subtitle() +std::string LayerGradientTest2::subtitle() { return "You should see a gradient"; } @@ -671,7 +671,7 @@ std::string LayerGradientTest3::title() return "LayerGradientTest 3"; } -string LayerGradientTest3::subtitle() +std::string LayerGradientTest3::subtitle() { return "You should see a gradient"; } @@ -858,12 +858,12 @@ LayerExtendedBlendOpacityTest::LayerExtendedBlendOpacityTest() addChild(layer3); } -string LayerExtendedBlendOpacityTest::title() +std::string LayerExtendedBlendOpacityTest::title() { return "Extended Blend & Opacity"; } -string LayerExtendedBlendOpacityTest::subtitle() +std::string LayerExtendedBlendOpacityTest::subtitle() { return "You should see 3 layers"; } diff --git a/samples/Cpp/TestCpp/Classes/NewEventDispatcherTest/NewEventDispatcherTest.cpp b/samples/Cpp/TestCpp/Classes/NewEventDispatcherTest/NewEventDispatcherTest.cpp index 4b4904a847..ade2210ff3 100644 --- a/samples/Cpp/TestCpp/Classes/NewEventDispatcherTest/NewEventDispatcherTest.cpp +++ b/samples/Cpp/TestCpp/Classes/NewEventDispatcherTest/NewEventDispatcherTest.cpp @@ -104,12 +104,12 @@ void EventDispatcherTestDemo::restartCallback(Object* sender) scene->release(); } -string EventDispatcherTestDemo::title() +std::string EventDispatcherTestDemo::title() { return "No title"; } -string EventDispatcherTestDemo::subtitle() +std::string EventDispatcherTestDemo::subtitle() { return ""; } diff --git a/samples/Cpp/TestCpp/Classes/NewRendererTest/NewRendererTest.cpp b/samples/Cpp/TestCpp/Classes/NewRendererTest/NewRendererTest.cpp index b896c5d624..b910b7c4da 100644 --- a/samples/Cpp/TestCpp/Classes/NewRendererTest/NewRendererTest.cpp +++ b/samples/Cpp/TestCpp/Classes/NewRendererTest/NewRendererTest.cpp @@ -88,12 +88,12 @@ MultiSceneTest::~MultiSceneTest() } -string MultiSceneTest::title() +std::string MultiSceneTest::title() { return BaseTest::title(); } -string MultiSceneTest::subtitle() +std::string MultiSceneTest::subtitle() { return BaseTest::subtitle(); } @@ -211,13 +211,12 @@ void NewSpriteTest::onTouchesEnded(const std::vector &touches, Event *e } - -string NewSpriteTest::title() +std::string NewSpriteTest::title() { return "NewRender"; } -string NewSpriteTest::subtitle() +std::string NewSpriteTest::subtitle() { return "SpriteTest"; } @@ -239,17 +238,17 @@ NewSpriteBatchTest::~NewSpriteBatchTest() } -string NewSpriteBatchTest::title() +std::string NewSpriteBatchTest::title() { return "NewRender"; } -string NewSpriteBatchTest::subtitle() +std::string NewSpriteBatchTest::subtitle() { return "SpriteBatchTest"; } -void NewSpriteBatchTest::onTouchesEnded(const vector &touches, Event *event) +void NewSpriteBatchTest::onTouchesEnded(const std::vector &touches, Event *event) { for (auto &touch : touches) { @@ -343,12 +342,12 @@ NewClippingNodeTest::~NewClippingNodeTest() } -string NewClippingNodeTest::title() +std::string NewClippingNodeTest::title() { return "New Render"; } -string NewClippingNodeTest::subtitle() +std::string NewClippingNodeTest::subtitle() { return "ClipNode"; } @@ -392,7 +391,7 @@ NewDrawNodeTest::NewDrawNodeTest() parent->setPosition(s.width/2, s.height/2); addChild(parent); - auto rectNode = NewDrawNode::create(); + auto rectNode = DrawNode::create(); Point rectangle[4]; rectangle[0] = Point(-50, -50); rectangle[1] = Point(50, -50); @@ -409,12 +408,12 @@ NewDrawNodeTest::~NewDrawNodeTest() } -string NewDrawNodeTest::title() +std::string NewDrawNodeTest::title() { return "New Render"; } -string NewDrawNodeTest::subtitle() +std::string NewDrawNodeTest::subtitle() { return "DrawNode"; } @@ -423,7 +422,7 @@ NewCullingTest::NewCullingTest() { auto s = Director::getInstance()->getWinSize(); - std::vector images; + std::vector images; images.push_back("Images/grossini_dance_01.png"); images.push_back("Images/grossini_dance_02.png"); images.push_back("Images/grossini_dance_03.png"); @@ -476,12 +475,12 @@ NewCullingTest::~NewCullingTest() } -string NewCullingTest::title() +std::string NewCullingTest::title() { return "New Render"; } -string NewCullingTest::subtitle() +std::string NewCullingTest::subtitle() { return "Culling"; } diff --git a/samples/Cpp/TestCpp/Classes/NewRendererTest/NewRendererTest.h b/samples/Cpp/TestCpp/Classes/NewRendererTest/NewRendererTest.h index 5e0bf64e61..39ab3b62df 100644 --- a/samples/Cpp/TestCpp/Classes/NewRendererTest/NewRendererTest.h +++ b/samples/Cpp/TestCpp/Classes/NewRendererTest/NewRendererTest.h @@ -11,8 +11,6 @@ #include "../testBasic.h" #include "../BaseTest.h" -using namespace std; - #define kTagSpriteBatchNode 100 #define kTagClipperNode 101 #define kTagContentNode 102 @@ -27,8 +25,8 @@ class MultiSceneTest : public BaseTest { public: CREATE_FUNC(MultiSceneTest); - virtual string title(); - virtual string subtitle(); + virtual std::string title(); + virtual std::string subtitle(); virtual void onEnter(); void restartCallback(Object* sender); @@ -46,8 +44,8 @@ class NewSpriteTest : public MultiSceneTest public: CREATE_FUNC(NewSpriteTest); - virtual string title(); - virtual string subtitle(); + virtual std::string title(); + virtual std::string subtitle(); void createSpriteTest(); void createNewSpriteTest(); @@ -63,10 +61,10 @@ class NewSpriteBatchTest : public MultiSceneTest public: CREATE_FUNC(NewSpriteBatchTest); - virtual string title(); - virtual string subtitle(); + virtual std::string title(); + virtual std::string subtitle(); - void onTouchesEnded(const vector& touches, Event* event); + void onTouchesEnded(const std::vector& touches, Event* event); void addNewSpriteWithCoords(Point p); protected: @@ -79,8 +77,8 @@ class NewClippingNodeTest : public MultiSceneTest public: CREATE_FUNC(NewClippingNodeTest); - virtual string title(); - virtual string subtitle(); + virtual std::string title(); + virtual std::string subtitle(); void onTouchesBegan(const std::vector& touches, Event *event); void onTouchesMoved(const std::vector& touches, Event *event); @@ -99,8 +97,8 @@ class NewDrawNodeTest : public MultiSceneTest public: CREATE_FUNC(NewDrawNodeTest) - virtual string title(); - virtual string subtitle(); + virtual std::string title(); + virtual std::string subtitle(); protected: NewDrawNodeTest(); @@ -112,8 +110,8 @@ class NewCullingTest : public MultiSceneTest public: CREATE_FUNC(NewCullingTest) - virtual string title(); - virtual string subtitle(); + virtual std::string title(); + virtual std::string subtitle(); protected: NewCullingTest(); diff --git a/samples/Cpp/TestCpp/Classes/RenderTextureTest/RenderTextureTest.cpp b/samples/Cpp/TestCpp/Classes/RenderTextureTest/RenderTextureTest.cpp index 069af3764c..0c49f29913 100644 --- a/samples/Cpp/TestCpp/Classes/RenderTextureTest/RenderTextureTest.cpp +++ b/samples/Cpp/TestCpp/Classes/RenderTextureTest/RenderTextureTest.cpp @@ -121,12 +121,12 @@ RenderTextureSave::RenderTextureSave() menu->setPosition(Point(VisibleRect::rightTop().x - 80, VisibleRect::rightTop().y - 30)); } -string RenderTextureSave::title() +std::string RenderTextureSave::title() { return "Touch the screen"; } -string RenderTextureSave::subtitle() +std::string RenderTextureSave::subtitle() { return "Press 'Save Image' to create an snapshot of the render texture"; } @@ -354,12 +354,12 @@ RenderTextureZbuffer::RenderTextureZbuffer() sp9->setColor(Color3B::YELLOW); } -string RenderTextureZbuffer::title() +std::string RenderTextureZbuffer::title() { return "Testing Z Buffer in Render Texture"; } -string RenderTextureZbuffer::subtitle() +std::string RenderTextureZbuffer::subtitle() { return "Touch screen. It should be green"; } @@ -557,12 +557,12 @@ void RenderTextureTargetNode::update(float dt) time += dt; } -string RenderTextureTargetNode::title() +std::string RenderTextureTargetNode::title() { return "Testing Render Target Node"; } -string RenderTextureTargetNode::subtitle() +std::string RenderTextureTargetNode::subtitle() { return "Sprites should be equal and move with each frame"; } diff --git a/samples/Cpp/TestCpp/Classes/ShaderTest/ShaderTest.cpp b/samples/Cpp/TestCpp/Classes/ShaderTest/ShaderTest.cpp index b9e297a8fd..9350badea0 100644 --- a/samples/Cpp/TestCpp/Classes/ShaderTest/ShaderTest.cpp +++ b/samples/Cpp/TestCpp/Classes/ShaderTest/ShaderTest.cpp @@ -744,12 +744,12 @@ ShaderFail::ShaderFail() p->release(); } -string ShaderFail::title() +std::string ShaderFail::title() { return "Shader: Invalid shader"; } -string ShaderFail::subtitle() +std::string ShaderFail::subtitle() { return "See console for output with useful error log"; } diff --git a/samples/Cpp/TestCpp/Classes/SpriteTest/SpriteTest.cpp.REMOVED.git-id b/samples/Cpp/TestCpp/Classes/SpriteTest/SpriteTest.cpp.REMOVED.git-id index bad2b4b3d0..ead63480cc 100644 --- a/samples/Cpp/TestCpp/Classes/SpriteTest/SpriteTest.cpp.REMOVED.git-id +++ b/samples/Cpp/TestCpp/Classes/SpriteTest/SpriteTest.cpp.REMOVED.git-id @@ -1 +1 @@ -64530cc9f89e92fb0946c9c3c6311f6c07741419 \ No newline at end of file +887344c810ec00253c0de1e8080a9d9b5b4ff92f \ No newline at end of file diff --git a/samples/Cpp/TestCpp/Classes/Texture2dTest/Texture2dTest.cpp b/samples/Cpp/TestCpp/Classes/Texture2dTest/Texture2dTest.cpp index 99a684a555..5e3e4363ae 100644 --- a/samples/Cpp/TestCpp/Classes/Texture2dTest/Texture2dTest.cpp +++ b/samples/Cpp/TestCpp/Classes/Texture2dTest/Texture2dTest.cpp @@ -803,12 +803,12 @@ void TexturePVR2BPPv3::onEnter() Director::getInstance()->getTextureCache()->dumpCachedTextureInfo(); } -string TexturePVR2BPPv3::title() +std::string TexturePVR2BPPv3::title() { return "PVR TC 2bpp Test"; } -string TexturePVR2BPPv3::subtitle() +std::string TexturePVR2BPPv3::subtitle() { return "Testing PVR File Format v3"; } @@ -830,12 +830,12 @@ void TexturePVRII2BPPv3::onEnter() Director::getInstance()->getTextureCache()->dumpCachedTextureInfo(); } -string TexturePVRII2BPPv3::title() +std::string TexturePVRII2BPPv3::title() { return "PVR TC II 2bpp Test"; } -string TexturePVRII2BPPv3::subtitle() +std::string TexturePVRII2BPPv3::subtitle() { return "Testing PVR File Format v3"; } @@ -861,12 +861,12 @@ void TexturePVR4BPPv3::onEnter() Director::getInstance()->getTextureCache()->dumpCachedTextureInfo(); } -string TexturePVR4BPPv3::title() +std::string TexturePVR4BPPv3::title() { return "PVR TC 4bpp Test"; } -string TexturePVR4BPPv3::subtitle() +std::string TexturePVR4BPPv3::subtitle() { return "Testing PVR File Format v3"; } @@ -896,12 +896,12 @@ void TexturePVRII4BPPv3::onEnter() Director::getInstance()->getTextureCache()->dumpCachedTextureInfo(); } -string TexturePVRII4BPPv3::title() +std::string TexturePVRII4BPPv3::title() { return "PVR TC II 4bpp Test"; } -string TexturePVRII4BPPv3::subtitle() +std::string TexturePVRII4BPPv3::subtitle() { return "Testing PVR File Format v3"; } @@ -923,12 +923,12 @@ void TexturePVRRGBA8888v3::onEnter() Director::getInstance()->getTextureCache()->dumpCachedTextureInfo(); } -string TexturePVRRGBA8888v3::title() +std::string TexturePVRRGBA8888v3::title() { return "PVR + RGBA 8888 Test"; } -string TexturePVRRGBA8888v3::subtitle() +std::string TexturePVRRGBA8888v3::subtitle() { return "Testing PVR File Format v3"; } @@ -954,12 +954,12 @@ void TexturePVRBGRA8888v3::onEnter() Director::getInstance()->getTextureCache()->dumpCachedTextureInfo(); } -string TexturePVRBGRA8888v3::title() +std::string TexturePVRBGRA8888v3::title() { return "PVR + BGRA 8888 Test"; } -string TexturePVRBGRA8888v3::subtitle() +std::string TexturePVRBGRA8888v3::subtitle() { return "Testing PVR File Format v3"; } @@ -981,12 +981,12 @@ void TexturePVRRGBA5551v3::onEnter() Director::getInstance()->getTextureCache()->dumpCachedTextureInfo(); } -string TexturePVRRGBA5551v3::title() +std::string TexturePVRRGBA5551v3::title() { return "PVR + RGBA 5551 Test"; } -string TexturePVRRGBA5551v3::subtitle() +std::string TexturePVRRGBA5551v3::subtitle() { return "Testing PVR File Format v3"; } @@ -1008,12 +1008,12 @@ void TexturePVRRGBA4444v3::onEnter() Director::getInstance()->getTextureCache()->dumpCachedTextureInfo(); } -string TexturePVRRGBA4444v3::title() +std::string TexturePVRRGBA4444v3::title() { return "PVR + RGBA 4444 Test"; } -string TexturePVRRGBA4444v3::subtitle() +std::string TexturePVRRGBA4444v3::subtitle() { return "Testing PVR File Format v3"; } @@ -1035,12 +1035,12 @@ void TexturePVRRGB565v3::onEnter() Director::getInstance()->getTextureCache()->dumpCachedTextureInfo(); } -string TexturePVRRGB565v3::title() +std::string TexturePVRRGB565v3::title() { return "PVR + RGB 565 Test"; } -string TexturePVRRGB565v3::subtitle() +std::string TexturePVRRGB565v3::subtitle() { return "Testing PVR File Format v3"; } @@ -1062,12 +1062,12 @@ void TexturePVRRGB888v3::onEnter() Director::getInstance()->getTextureCache()->dumpCachedTextureInfo(); } -string TexturePVRRGB888v3::title() +std::string TexturePVRRGB888v3::title() { return "PVR + RGB 888 Test"; } -string TexturePVRRGB888v3::subtitle() +std::string TexturePVRRGB888v3::subtitle() { return "Testing PVR File Format v3"; } @@ -1089,12 +1089,12 @@ void TexturePVRA8v3::onEnter() Director::getInstance()->getTextureCache()->dumpCachedTextureInfo(); } -string TexturePVRA8v3::title() +std::string TexturePVRA8v3::title() { return "PVR + A8 Test"; } -string TexturePVRA8v3::subtitle() +std::string TexturePVRA8v3::subtitle() { return "Testing PVR File Format v3"; } @@ -1116,12 +1116,12 @@ void TexturePVRI8v3::onEnter() Director::getInstance()->getTextureCache()->dumpCachedTextureInfo(); } -string TexturePVRI8v3::title() +std::string TexturePVRI8v3::title() { return "PVR + I8 Test"; } -string TexturePVRI8v3::subtitle() +std::string TexturePVRI8v3::subtitle() { return "Testing PVR File Format v3"; } @@ -1143,12 +1143,12 @@ void TexturePVRAI88v3::onEnter() Director::getInstance()->getTextureCache()->dumpCachedTextureInfo(); } -string TexturePVRAI88v3::title() +std::string TexturePVRAI88v3::title() { return "PVR + AI88 Test"; } -string TexturePVRAI88v3::subtitle() +std::string TexturePVRAI88v3::subtitle() { return "Testing PVR File Format v3"; } @@ -1889,7 +1889,7 @@ void TextureMemoryAlloc::updateImage(cocos2d::Object *sender) Director::getInstance()->getTextureCache()->removeUnusedTextures(); int tag = ((Node*)sender)->getTag(); - string file; + std::string file; switch (tag) { case 0: @@ -1934,12 +1934,12 @@ void TextureMemoryAlloc::updateImage(cocos2d::Object *sender) _background->setPosition(Point(s.width/2, s.height/2)); } -string TextureMemoryAlloc::title() +std::string TextureMemoryAlloc::title() { return "Texture memory"; } -string TextureMemoryAlloc::subtitle() +std::string TextureMemoryAlloc::subtitle() { return "Testing Texture Memory allocation. Use Instruments + VM Tracker"; } diff --git a/samples/Cpp/TestCpp/Classes/TileMapTest/TileMapTest.cpp b/samples/Cpp/TestCpp/Classes/TileMapTest/TileMapTest.cpp index e200263fdb..009617cb2a 100644 --- a/samples/Cpp/TestCpp/Classes/TileMapTest/TileMapTest.cpp +++ b/samples/Cpp/TestCpp/Classes/TileMapTest/TileMapTest.cpp @@ -782,7 +782,7 @@ void TMXIsoZorder::repositionSprite(float dt) // if tamara < 144,z=2 int newZ = 4 - (p.y / 48); - newZ = max(newZ,0); + newZ = std::max(newZ,0); map->reorderChild(_tamara, newZ); } @@ -843,7 +843,7 @@ void TMXOrthoZorder::repositionSprite(float dt) // -10: customization for this particular sample int newZ = 4 - ( (p.y-10) / 81); - newZ = max(newZ,0); + newZ = std::max(newZ,0); map->reorderChild(_tamara, newZ); } @@ -1184,8 +1184,8 @@ void TMXOrthoFlipRunTimeTest::flipIt(float dt) TMXOrthoFromXMLTest::TMXOrthoFromXMLTest() { - string resources = "TileMaps"; // partial paths are OK as resource paths. - string file = resources + "/orthogonal-test1.tmx"; + std::string resources = "TileMaps"; // partial paths are OK as resource paths. + std::string file = resources + "/orthogonal-test1.tmx"; auto str = String::createWithContentsOfFile(FileUtils::getInstance()->fullPathForFilename(file.c_str()).c_str()); CCASSERT(str != NULL, "Unable to open file"); @@ -1469,12 +1469,12 @@ void TMXGIDObjectsTest::draw() } } -string TMXGIDObjectsTest::title() +std::string TMXGIDObjectsTest::title() { return "TMX GID objects"; } -string TMXGIDObjectsTest::subtitle() +std::string TMXGIDObjectsTest::subtitle() { return "Tiles are created from an object group"; } diff --git a/samples/Cpp/TestCpp/Classes/UserDefaultTest/UserDefaultTest.cpp b/samples/Cpp/TestCpp/Classes/UserDefaultTest/UserDefaultTest.cpp index 70d21c3cd4..ae440e66db 100644 --- a/samples/Cpp/TestCpp/Classes/UserDefaultTest/UserDefaultTest.cpp +++ b/samples/Cpp/TestCpp/Classes/UserDefaultTest/UserDefaultTest.cpp @@ -29,7 +29,7 @@ void UserDefaultTest::doTest() // print value - string ret = UserDefault::getInstance()->getStringForKey("string"); + std::string ret = UserDefault::getInstance()->getStringForKey("string"); CCLOG("string is %s", ret.c_str()); double d = UserDefault::getInstance()->getDoubleForKey("double"); diff --git a/samples/Cpp/TestCpp/Classes/testBasic.h b/samples/Cpp/TestCpp/Classes/testBasic.h index e6ddd8f9f3..fe00736d5d 100644 --- a/samples/Cpp/TestCpp/Classes/testBasic.h +++ b/samples/Cpp/TestCpp/Classes/testBasic.h @@ -6,8 +6,6 @@ USING_NS_CC; -using namespace std; - class TestScene : public Scene { public: