Commit c33348aa authored by Millian Poquet's avatar Millian Poquet
Browse files

C++11 regex -> boost::regex

The regex part of the C++11 standard was not implemented before june 2015.
To avoid forcing users to have a very recent compiler, switching to boost instead.
parent 14cf83d6
......@@ -50,7 +50,7 @@ find_package(SimGrid REQUIRED)
include_directories(${SIMGRID_INCLUDE_DIR})
## Boost dependency
find_package(Boost 1.48 REQUIRED COMPONENTS system filesystem)
find_package(Boost 1.48 REQUIRED COMPONENTS system filesystem regex)
include_directories(${Boost_INCLUDE_DIR})
## Rapidjson dependency
......@@ -84,6 +84,7 @@ add_executable(batsim ${batsim_SRC})
target_link_libraries(batsim ${SIMGRID_LIBRARIES}
${Boost_SYSTEM_LIBRARY_DEBUG}
${Boost_FILESYSTEM_LIBRARY_DEBUG}
${Boost_REGEX_LIBRARY_DEBUG}
${REDOX_LIBRARY}
${LIBEV_LIBRARY}
${HIREDIS_LIBRARY})
......
......@@ -10,8 +10,7 @@
#include <fstream>
#include <streambuf>
#include <algorithm>
#include <regex>
#include <iterator>
#include <boost/regex.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/join.hpp>
......@@ -208,9 +207,9 @@ Job * Job::from_json(const rapidjson::Value & json_desc, Workload * workload)
// Let's replace the job ID by its WLOAD!NUMBER counterpart
string json_description_tmp = buffer.GetString();
regex r("\"id\"\\s*:\\s*(?:\".+\"|\\d+)\\s*,");
boost::regex r("\"id\"\\s*:\\s*(?:\".+\"|\\d+)\\s*,");
string replacement_str = "\"id\":\"" + workload_name + "!" + std::to_string(j->number) + "\",";
j->json_description = regex_replace(json_description_tmp, r, replacement_str);
j->json_description = boost::regex_replace(json_description_tmp, r, replacement_str);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment