]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/sockets/client.cpp
compilation fix for g++ which doesn't like using wxLogMessage in wxON_BLOCK_SCOPE_EXIT
[wxWidgets.git] / samples / sockets / client.cpp
index e0604c063cb229b5673781ff51a795344557215f..f4b3fc79a8a015de20ed10a482b34dc8f61e1150 100644 (file)
@@ -32,7 +32,6 @@
 #include "wx/socket.h"
 #include "wx/url.h"
 #include "wx/sstream.h"
-#include "wx/scopeguard.h"
 #include <memory>
 
 // --------------------------------------------------------------------------
@@ -104,6 +103,24 @@ private:
   DECLARE_EVENT_TABLE()
 };
 
+// simple helper class to log start and end of each test
+class TestLogger
+{
+public:
+    TestLogger(const wxString& name) : m_name(name)
+    {
+        wxLogMessage("=== %s test begins ===", m_name);
+    }
+
+    ~TestLogger()
+    {
+        wxLogMessage("=== %s test ends ===", m_name);
+    }
+
+private:
+    const wxString m_name;
+};
+
 // --------------------------------------------------------------------------
 // constants
 // --------------------------------------------------------------------------
@@ -595,8 +612,7 @@ void MyFrame::OnTestURL(wxCommandEvent& WXUNUSED(event))
     s_urlname = urlname;
 
 
-    wxLogMessage("=== URL test begins ===");
-    wxON_BLOCK_EXIT1( wxLogMessage, "=== URL test ends ===" );
+    TestLogger logtest("URL");
 
     // Parse the URL
     wxURL url(urlname);