changeset 706:ef07304d4423

Fixed C++ code to be C++03 compatible
author Benjamin Golinvaux <bgo@osimis.io>
date Mon, 20 May 2019 11:03:36 +0200
parents f45fca2ebd10
children d1feb89ea742
files Samples/Sdl/BasicScene.cpp Samples/Sdl/TrackerSampleApp.cpp
diffstat 2 files changed, 16 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/Samples/Sdl/BasicScene.cpp	Mon May 20 09:38:25 2019 +0200
+++ b/Samples/Sdl/BasicScene.cpp	Mon May 20 11:03:36 2019 +0200
@@ -324,13 +324,13 @@
             event.button.x, event.button.y));
           tracker->PointerUp(e);
           if(!tracker->IsAlive())
-            tracker = NULL;
+            tracker.reset();
         }
       }
       else if (event.type == SDL_WINDOWEVENT &&
                event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED)
       {
-        tracker = NULL;
+        tracker.reset();
         compositor.UpdateSize();
       }
       else if (event.type == SDL_KEYDOWN &&
--- a/Samples/Sdl/TrackerSampleApp.cpp	Mon May 20 09:38:25 2019 +0200
+++ b/Samples/Sdl/TrackerSampleApp.cpp	Mon May 20 11:03:36 2019 +0200
@@ -88,11 +88,13 @@
       return;
 
     std::stringstream msg;
-    for (auto kv : infoTextMap_)
+	
+	for (std::map<std::string, std::string>::const_iterator kv = infoTextMap_.begin();
+		kv != infoTextMap_.end(); ++kv)
     {
-      msg << kv.first << " : " << kv.second << std::endl;
+      msg << kv->first << " : " << kv->second << std::endl;
     }
-    auto msgS = msg.str();
+	std::string msgS = msg.str();
 
     TextSceneLayer* layerP = NULL;
     if (GetScene()->HasLayer(FIXED_INFOTEXT_LAYER_ZINDEX))
@@ -193,7 +195,7 @@
           
           activeTracker_->PointerMove(e);
           if (!activeTracker_->IsAlive())
-            activeTracker_ = NULL;
+            activeTracker_.reset();
         }
       }
     }
@@ -205,7 +207,7 @@
         e.AddPosition(compositor_->GetPixelCenterCoordinates(event.button.x, event.button.y));
         activeTracker_->PointerUp(e);
         if (!activeTracker_->IsAlive())
-          activeTracker_ = NULL;
+          activeTracker_.reset();
       }
     }
     else if (event.type == SDL_MOUSEBUTTONDOWN)
@@ -217,7 +219,7 @@
       {
         activeTracker_->PointerDown(e);
         if (!activeTracker_->IsAlive())
-          activeTracker_ = NULL;
+          activeTracker_.reset();
       }
       else
       {
@@ -235,7 +237,7 @@
         {
           activeTracker_->Cancel();
           if (!activeTracker_->IsAlive())
-            activeTracker_ = NULL;
+            activeTracker_.reset();
         }
         break;
 
@@ -331,20 +333,19 @@
         case GuiTool_AngleMeasure:
           return FlexiblePointerTrackerPtr(new CreateAngleMeasureTracker(
             IObserver::GetBroker(), controller_, undoStack_, measureTools_, e));
-          return NULL;
         case GuiTool_CircleMeasure:
           LOG(ERROR) << "Not implemented yet!";
-          return NULL;
+          return FlexiblePointerTrackerPtr();
         case GuiTool_EllipseMeasure:
           LOG(ERROR) << "Not implemented yet!";
-          return NULL;
+          return FlexiblePointerTrackerPtr();
         default:
           throw OrthancException(ErrorCode_InternalError, "Wrong tool!");
         }
       }
     }
     default:
-      return NULL;
+      return FlexiblePointerTrackerPtr();
     }
   }
 
@@ -461,7 +462,7 @@
     if (activeTracker_)
     {
       activeTracker_->Cancel();
-      activeTracker_ = NULL;
+      activeTracker_.reset();
     }
   }
 
@@ -487,7 +488,7 @@
   FlexiblePointerTrackerPtr TrackerSampleApp::TrackerHitTest(const PointerEvent & e)
   {
     // std::vector<MeasureToolPtr> measureTools_;
-    return nullptr;
+    return FlexiblePointerTrackerPtr();
   }
 
   static void GLAPIENTRY