← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/replace-regex into lp:widelands

 

GunChleoc has proposed merging lp:~widelands-dev/widelands/replace-regex into lp:widelands.

Commit message:
Replaced boost::regex with std::regex. Define that network is using a boost library.

Requested reviews:
  Widelands Developers (widelands-dev)

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/replace-regex/+merge/334523

The functions in boost::regex are part of C++11, so we don't need that dependency any more.

We do need the boost::system dependency though, which wasn't stated in libnetwork. This made my clang linker crap out.
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/replace-regex into lp:widelands.
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt	2017-11-28 09:55:37 +0000
+++ CMakeLists.txt	2017-11-30 10:56:07 +0000
@@ -50,7 +50,6 @@
 find_package(Boost 1.48
   COMPONENTS
     unit_test_framework
-    regex
   REQUIRED
     system)
 

=== modified file 'cmake/WlFunctions.cmake'
--- cmake/WlFunctions.cmake	2017-05-14 21:06:23 +0000
+++ cmake/WlFunctions.cmake	2017-11-30 10:56:07 +0000
@@ -5,7 +5,7 @@
     THIRD_PARTY  # Is a third party lib. Less warnings, no codecheck.
     C_LIBRARY # Pure C library. No CXX flags.
     WIN32 # Windows binary/library.
-    USES_BOOST_REGEX
+    USES_BOOST_LIBRARY
     USES_INTL
     USES_OPENGL
     USES_PNG
@@ -145,7 +145,7 @@
     endif()
   endif()
 
-  if (ARG_USES_BOOST_REGEX)
+  if (ARG_USES_BOOST_LIBRARY)
     target_link_libraries(${NAME} ${Boost_LIBRARIES})
   endif()
 

=== modified file 'src/io/filesystem/layered_filesystem.cc'
--- src/io/filesystem/layered_filesystem.cc	2017-08-18 14:27:26 +0000
+++ src/io/filesystem/layered_filesystem.cc	2017-11-30 10:56:07 +0000
@@ -21,9 +21,9 @@
 
 #include <cstdio>
 #include <memory>
+#include <regex>
 
 #include <boost/algorithm/string/predicate.hpp>
-#include <boost/regex.hpp>
 
 #include "base/log.h"
 #include "base/wexception.h"
@@ -47,10 +47,10 @@
 	// http://www.linfo.org/file_name.html
 	// https://support.apple.com/en-us/HT202808
 	// We can't just regex for word & digit characters here because of non-Latin scripts.
-	boost::regex re(".*[<>:\"|?*/\\\\].*");
+	std::regex re(".*[<>:\"|?*/\\\\].*");
 	return !filename.empty() && !boost::starts_with(filename, ".") &&
 	       !boost::starts_with(filename, " ") && !boost::starts_with(filename, "-") &&
-	       !boost::regex_match(filename, re);
+	       !std::regex_match(filename, re);
 }
 
 /**

=== modified file 'src/network/CMakeLists.txt'
--- src/network/CMakeLists.txt	2017-11-25 20:29:26 +0000
+++ src/network/CMakeLists.txt	2017-11-30 10:56:07 +0000
@@ -27,6 +27,7 @@
     network_player_settings_backend.cc
     network_player_settings_backend.h
     network_protocol.h
+  USES_BOOST_LIBRARY
   DEPENDS
     ai
     base_exceptions

=== modified file 'src/sound/CMakeLists.txt'
--- src/sound/CMakeLists.txt	2017-03-04 11:40:59 +0000
+++ src/sound/CMakeLists.txt	2017-11-30 10:56:07 +0000
@@ -16,7 +16,6 @@
     songset.h
     sound_handler.cc
     sound_handler.h
-  USES_BOOST_REGEX
   USES_SDL2
   USES_SDL2_MIXER
   DEPENDS

=== modified file 'src/sound/sound_handler.cc'
--- src/sound/sound_handler.cc	2017-08-16 04:31:56 +0000
+++ src/sound/sound_handler.cc	2017-11-30 10:56:07 +0000
@@ -21,11 +21,11 @@
 
 #include <cerrno>
 #include <memory>
+#include <regex>
 
 #include <SDL.h>
 #include <SDL_mixer.h>
 #include <boost/algorithm/string/predicate.hpp>
-#include <boost/regex.hpp>
 #ifdef _WIN32
 #include <windows.h>
 #endif
@@ -249,9 +249,9 @@
 
 	fxs_.insert(std::make_pair(fx_name, std::unique_ptr<FXset>(new FXset())));
 
-	boost::regex re(basename + "_\\d+\\.ogg");
+	std::regex re(basename + "_\\d+\\.ogg");
 	FilenameSet files = filter(g_fs->list_directory(dir), [&re](const std::string& fn) {
-		return boost::regex_match(FileSystem::fs_filename(fn.c_str()), re);
+		return std::regex_match(FileSystem::fs_filename(fn.c_str()), re);
 	});
 
 	for (const std::string& path : files) {

=== modified file 'src/ui_basic/CMakeLists.txt'
--- src/ui_basic/CMakeLists.txt	2017-02-28 20:07:07 +0000
+++ src/ui_basic/CMakeLists.txt	2017-11-30 10:56:07 +0000
@@ -51,7 +51,6 @@
     unique_window.h
     window.cc
     window.h
-  USES_BOOST_REGEX
   USES_SDL2
   DEPENDS
     base_exceptions

=== modified file 'src/wlapplication.cc'
--- src/wlapplication.cc	2017-11-25 20:29:26 +0000
+++ src/wlapplication.cc	2017-11-30 10:56:07 +0000
@@ -29,6 +29,7 @@
 #include <fstream>
 #include <iostream>
 #include <memory>
+#include <regex>
 #include <stdexcept>
 #include <string>
 
@@ -36,7 +37,6 @@
 #include <SDL_ttf.h>
 #include <boost/algorithm/string/predicate.hpp>
 #include <boost/format.hpp>
-#include <boost/regex.hpp>
 #ifdef __APPLE__
 #include <mach-o/dyld.h>
 #include <unistd.h>
@@ -145,8 +145,8 @@
 }
 
 bool is_absolute_path(const std::string& path) {
-	boost::regex re("^/|\\w:");
-	return boost::regex_search(path.c_str(), re);
+	std::regex re("^/|\\w:");
+	return std::regex_search(path.c_str(), re);
 }
 
 // Returns the absolute path of 'path' which might be relative.


Follow ups