Skip to content

Commit 25ce127

Browse files
authored
Merge pull request #26 from FAIRDataPipeline/hotfix/gcc_fix
switch to boost/regex
2 parents a89d1fe + 8deacd5 commit 25ce127

File tree

9 files changed

+30
-12
lines changed

9 files changed

+30
-12
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ INCLUDE( external/curl.cmake )
6363
INCLUDE( external/yaml_cpp.cmake )
6464
INCLUDE( external/toml11.cmake )
6565
INCLUDE( external/ghc.cmake )
66+
INCLUDE( external/boost_regex.cmake )
6667

6768
# Add the src dirctory compiling it's CMakeLists.txt
6869
ADD_SUBDIRECTORY( src )

external/boost_regex.cmake

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
MESSAGE( STATUS "[Boost Regex]" )
2+
3+
set(BRX_URL "https://github.com/boostorg/regex/archive/refs/tags/boost-1.79.0.zip")
4+
5+
MESSAGE( STATUS "\tBoost Regex Will be installed." )
6+
MESSAGE( STATUS "\tURL: ${BRX_URL}" )
7+
8+
set(BOOST_REGEX_STANDALONE ON)
9+
10+
include(FetchContent)
11+
FetchContent_Declare(
12+
BRX
13+
URL ${BRX_URL}
14+
)
15+
FetchContent_MakeAvailable(BRX)

include/fdp/objects/config.hxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include <string>
1616
#include <ghc/filesystem.hpp>
1717
#include <yaml-cpp/yaml.h>
18-
#include <regex>
18+
#include <boost/regex.hpp>
1919
#include <map>
2020
#include <ghc/filesystem.hpp>
2121
#include <stdio.h>

include/fdp/objects/metadata.hxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include <sstream>
1919
#include <random>
2020
#include <chrono>
21-
#include <regex>
21+
#include <boost/regex.hpp>
2222

2323
#include "digestpp.hpp"
2424

include/fdp/registry/api.hxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include <iterator>
1919
#include <json/reader.h>
2020
#include <map>
21-
#include <regex>
21+
#include <boost/regex.hpp>
2222
#include <string>
2323
#include <vector>
2424

src/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ TARGET_INCLUDE_DIRECTORIES( ${FDPAPI} PUBLIC ${yamlcpp_SOURCE_DIR}/include )
2121
TARGET_INCLUDE_DIRECTORIES( ${FDPAPI} PUBLIC ${CURL_INCLUDE_DIRS} )
2222
TARGET_INCLUDE_DIRECTORIES( ${FDPAPI} PUBLIC ${digestpp_SOURCE_DIR} )
2323
TARGET_INCLUDE_DIRECTORIES( ${FDPAPI} PUBLIC ${ghc_SOURCE_DIR}/include )
24+
TARGET_INCLUDE_DIRECTORIES( ${FDPAPI} PUBLIC ${brx_SOURCE_DIR}/include )
2425
# Toml 11 is a header only library no need to link
2526
TARGET_INCLUDE_DIRECTORIES( ${FDPAPI} PUBLIC ${tomlcpp_SOURCE_DIR} )
2627

@@ -29,6 +30,7 @@ TARGET_LINK_LIBRARIES( ${FDPAPI} PUBLIC jsoncpp_static )
2930
TARGET_LINK_LIBRARIES( ${FDPAPI} PUBLIC digestpp )
3031
TARGET_LINK_LIBRARIES( ${FDPAPI} PUBLIC yaml-cpp )
3132
TARGET_LINK_LIBRARIES( ${FDPAPI} PUBLIC ghc_filesystem )
33+
TARGET_LINK_LIBRARIES( ${FDPAPI} PUBLIC boost_regex )
3234
TARGET_LINK_LIBRARIES( ${FDPAPI} PUBLIC ${CURL_LIBRARIES} )
3335

3436
# Install the libraries

src/objects/config.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ void FairDataPipeline::Config::initialise(RESTAPI api_location) {
327327
Json::Value j_code_repo_root = api_->post("storage_root", repo_storage_root_value_, token_);
328328
this->code_repo_storage_root_ = ApiObject::from_json( j_code_repo_root );
329329

330-
std::string repo_storage_path_ = std::regex_replace(meta_data_()["remote_repo"].as<std::string>(), std::regex(repo_storage_root_value_["root"].asString()), "");
330+
std::string repo_storage_path_ = boost::regex_replace(meta_data_()["remote_repo"].as<std::string>(), boost::regex(repo_storage_root_value_["root"].asString()), "");
331331

332332
Json::Value repo_storage_location_value_;
333333
repo_storage_location_value_["hash"] = meta_data_()["latest_commit"].as<std::string>();

src/objects/metadata.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ std::string current_time_stamp(bool file_name) {
6565
}
6666

6767
std::string remove_local_from_root(const std::string &root){
68-
return std::regex_replace(root, std::regex(std::string("file:\\/\\/")), "");
68+
return boost::regex_replace(root, boost::regex(std::string("file:\\/\\/")), "");
6969
}
7070

7171
std::string remove_backslash_from_path(const std::string &path){
72-
return std::regex_replace(path, std::regex(std::string("\\\\")), "/");
72+
return boost::regex_replace(path, boost::regex(std::string("\\\\")), "/");
7373
}
7474

7575
bool file_exists( const std::string &Filename )

src/registry/api.cxx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ CURL *API::setup_download_session_(const ghc::filesystem::path &addr_path,
9595

9696
Json::Value API::get_request(const ghc::filesystem::path &addr_path,
9797
long expected_response, std::string token) {
98-
std::string addr_path_ = std::regex_replace(addr_path.string(), std::regex(std::string("\\\\")), "/");
98+
std::string addr_path_ = boost::regex_replace(addr_path.string(), boost::regex(std::string("\\\\")), "/");
9999
return get_request(addr_path_, expected_response);
100100
}
101101

@@ -180,16 +180,16 @@ std::string API::json_to_query_string(Json::Value &json_value) {
180180
// add the key and value to the return string after removing the api
181181
// address with regex
182182
rtn += key + "=" +
183-
std::regex_replace(json_value.get(key, "")[i].asString(),
184-
std::regex(regex_string), "$3") +
183+
boost::regex_replace(json_value.get(key, "")[i].asString(),
184+
boost::regex(regex_string), "$3") +
185185
"&";
186186
}
187187
} else {
188188
// if it's not an array add the key and value to the return string after
189189
// removing the api address with regex
190190
rtn += key + "=" +
191-
std::regex_replace(json_value.get(key, "").asString(),
192-
std::regex(regex_string), "$3") +
191+
boost::regex_replace(json_value.get(key, "").asString(),
192+
boost::regex(regex_string), "$3") +
193193
"&";
194194
}
195195
}
@@ -200,7 +200,7 @@ std::string API::json_to_query_string(Json::Value &json_value) {
200200

201201
std::string API::escape_space(std::string &str) {
202202
// Using regex replace space with html character (%20)
203-
return std::string(std::regex_replace(str, std::regex(" "), "%20"));
203+
return std::string(boost::regex_replace(str, boost::regex(" "), "%20"));
204204
}
205205

206206
Json::Value API::post(std::string addr_path, Json::Value &post_data,

0 commit comments

Comments
 (0)