From 61a045c58820384f474442547fd4462244d20ddf Mon Sep 17 00:00:00 2001 From: Dimitre Date: Fri, 24 Feb 2023 20:21:21 -0300 Subject: [PATCH] General changes (namespace, deprecated loadFile function) (#7344) #changelog #core --- .../src/ofxAssimpTexture.cpp | 1 - addons/ofxGui/src/ofxSliderGroup.cpp | 5 ++--- .../src/ofxThreadedImageLoader.cpp | 4 ++-- .../src/ofxThreadedImageLoader.h | 20 +++++++++---------- addons/ofxXmlSettings/src/ofxXmlSettings.cpp | 3 +-- 5 files changed, 14 insertions(+), 19 deletions(-) diff --git a/addons/ofxAssimpModelLoader/src/ofxAssimpTexture.cpp b/addons/ofxAssimpModelLoader/src/ofxAssimpTexture.cpp index 676b92f72f2..52bc151ebef 100644 --- a/addons/ofxAssimpModelLoader/src/ofxAssimpTexture.cpp +++ b/addons/ofxAssimpModelLoader/src/ofxAssimpTexture.cpp @@ -6,7 +6,6 @@ // #include "ofxAssimpTexture.h" -#include "ofConstants.h" #include "ofLog.h" void ofxAssimpTexture::setup(const ofTexture & texture, std::string texturePath, bool bTexRepeat) { diff --git a/addons/ofxGui/src/ofxSliderGroup.cpp b/addons/ofxGui/src/ofxSliderGroup.cpp index 19897fd9324..ed8d8927f77 100644 --- a/addons/ofxGui/src/ofxSliderGroup.cpp +++ b/addons/ofxGui/src/ofxSliderGroup.cpp @@ -1,5 +1,4 @@ #include "ofxSliderGroup.h" -using namespace std; template ofxVecSlider_::ofxVecSlider_(ofParameter value, float width, float height){ @@ -13,7 +12,7 @@ ofxVecSlider_ * ofxVecSlider_::setup(ofParameter valu parameters.clear(); listeners.unsubscribeAll(); - const string names[4] = {"x", "y", "z", "w"}; + const std::string names[4] = {"x", "y", "z", "w"}; this->value.makeReferenceTo(value); listeners.push(this->value.newListener(this, & ofxVecSlider_::changeValue)); @@ -130,7 +129,7 @@ ofxColorSlider_ * ofxColorSlider_::setup(ofParameter val = value; ofColor_ min = value.getMin(); diff --git a/addons/ofxThreadedImageLoader/src/ofxThreadedImageLoader.cpp b/addons/ofxThreadedImageLoader/src/ofxThreadedImageLoader.cpp index a6c118bfad2..055951665a9 100644 --- a/addons/ofxThreadedImageLoader/src/ofxThreadedImageLoader.cpp +++ b/addons/ofxThreadedImageLoader/src/ofxThreadedImageLoader.cpp @@ -19,7 +19,7 @@ ofxThreadedImageLoader::~ofxThreadedImageLoader(){ // Load an image from disk. //-------------------------------------------------------------- -void ofxThreadedImageLoader::loadFromDisk(ofImage& image, string filename) { +void ofxThreadedImageLoader::loadFromDisk(ofImage& image, std::string filename) { nextID++; ofImageLoaderEntry entry(image); entry.filename = filename; @@ -32,7 +32,7 @@ void ofxThreadedImageLoader::loadFromDisk(ofImage& image, string filename) { // Load an url asynchronously from an url. //-------------------------------------------------------------- -void ofxThreadedImageLoader::loadFromURL(ofImage& image, string url) { +void ofxThreadedImageLoader::loadFromURL(ofImage& image, std::string url) { nextID++; ofImageLoaderEntry entry(image); entry.url = url; diff --git a/addons/ofxThreadedImageLoader/src/ofxThreadedImageLoader.h b/addons/ofxThreadedImageLoader/src/ofxThreadedImageLoader.h index 8bd918123b3..dd1d094db5c 100644 --- a/addons/ofxThreadedImageLoader/src/ofxThreadedImageLoader.h +++ b/addons/ofxThreadedImageLoader/src/ofxThreadedImageLoader.h @@ -3,19 +3,16 @@ #include "ofThread.h" #include "ofImage.h" #include "ofURLFileLoader.h" -#include "ofTypes.h" +#include "ofTypes.h" #include "ofThreadChannel.h" - -using namespace std; - class ofxThreadedImageLoader : public ofThread { public: ofxThreadedImageLoader(); ~ofxThreadedImageLoader(); - void loadFromDisk(ofImage& image, string file); - void loadFromURL(ofImage& image, string url); + void loadFromDisk(ofImage& image, std::string file); + void loadFromURL(ofImage& image, std::string url); @@ -26,6 +23,7 @@ class ofxThreadedImageLoader : public ofThread { // Entry to load. struct ofImageLoaderEntry { + public: ofImageLoaderEntry() { image = NULL; } @@ -34,18 +32,18 @@ class ofxThreadedImageLoader : public ofThread { image = &pImage; } ofImage* image; - string filename; - string url; - string name; + std::string filename; + std::string url; + std::string name; }; - typedef map::iterator entry_iterator; + typedef std::map::iterator entry_iterator; int nextID; int lastUpdate; - map images_async_loading; // keeps track of images which are loading async + std::map images_async_loading; // keeps track of images which are loading async ofThreadChannel images_to_load_from_disk; ofThreadChannel images_to_update; }; diff --git a/addons/ofxXmlSettings/src/ofxXmlSettings.cpp b/addons/ofxXmlSettings/src/ofxXmlSettings.cpp index 41bfa0f8ffe..c23c91d3675 100644 --- a/addons/ofxXmlSettings/src/ofxXmlSettings.cpp +++ b/addons/ofxXmlSettings/src/ofxXmlSettings.cpp @@ -28,7 +28,6 @@ static vector tokenize(const string & str, const string & delim) } return tokens; } -//---------------------------------------- //---------------------------------------- ofxXmlSettings::ofxXmlSettings(): @@ -48,7 +47,7 @@ ofxXmlSettings::ofxXmlSettings(const string& xmlFile): //we do this so that we have a valid handle //without the need for loadFile storedHandle = TiXmlHandle(&doc); - loadFile(xmlFile); + load(xmlFile); } //---------------------------------------------------------