Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace boost::regex with std::regex #34826

Merged
merged 2 commits into from
Aug 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 10 additions & 13 deletions CondCore/CondDB/interface/Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
#include <unistd.h>
#include <pwd.h>
#include <climits>
//
#include <boost/regex.hpp>
#include <regex>

namespace cond {

Expand Down Expand Up @@ -123,10 +122,10 @@ namespace cond {
if (input.find("sqlite") == 0 || input.find("oracle") == 0)
return input;

//static const boost::regex trivial("oracle://(cms_orcon_adg|cms_orcoff_prep)/([_[:alnum:]]+?)");
static const boost::regex short_frontier("frontier://([[:alnum:]]+?)/([_[:alnum:]]+?)");
static const boost::regex long_frontier("frontier://((\\([-[:alnum:]]+?=[^\\)]+?\\))+)/([_[:alnum:]]+?)");
static const boost::regex long_frontier_serverurl("\\(serverurl=[^\\)]+?/([[:alnum:]]+?)\\)");
//static const std::regex trivial("oracle://(cms_orcon_adg|cms_orcoff_prep)/([_[:alnum:]]+?)");
static const std::regex short_frontier("frontier://([[:alnum:]]+?)/([_[:alnum:]]+?)");
static const std::regex long_frontier("frontier://((\\([-[:alnum:]]+?=[^\\)]+?\\))+)/([_[:alnum:]]+?)");
static const std::regex long_frontier_serverurl("\\(serverurl=[^\\)]+?/([[:alnum:]]+?)\\)");

static const std::map<std::string, std::string> frontierMap = {
{"PromptProd", "cms_orcon_adg"},
Expand All @@ -136,23 +135,21 @@ namespace cond {
{"FrontierPrep", "cms_orcoff_prep"},
};

boost::smatch matches;
std::smatch matches;

static const std::string technology("oracle://");
std::string service("");
std::string account("");

bool match = false;
if (boost::regex_match(input, matches, short_frontier)) {
if (std::regex_match(input, matches, short_frontier)) {
service = matches[1];
account = matches[2];
match = true;
}

if (boost::regex_match(input, matches, long_frontier)) {
} else if (std::regex_match(input, matches, long_frontier)) {
std::string frontier_config(matches[1]);
boost::smatch matches2;
if (not boost::regex_search(frontier_config, matches2, long_frontier_serverurl))
std::smatch matches2;
if (not std::regex_search(frontier_config, matches2, long_frontier_serverurl))
throwException("No serverurl in matched long frontier", "convertoToOracleConnection");
service = matches2[1];
account = matches[3];
Expand Down
1 change: 1 addition & 0 deletions CondCore/Utilities/interface/PayloadInspector.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <string>
#include <tuple>
#include <vector>
#include <set>
#include <type_traits>

#include "FWCore/Utilities/interface/GlobalIdentifier.h"
Expand Down