Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mantid
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mantidproject
mantid
Commits
7c02c8ca
Commit
7c02c8ca
authored
6 years ago
by
Marina Ganeva
Browse files
Options
Downloads
Patches
Plain Diff
Refs #21293 replace std::regex with boost::regex for rhel7
parent
cd7f3af8
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Framework/MDAlgorithms/src/LoadDNSSCD.cpp
+13
-13
13 additions, 13 deletions
Framework/MDAlgorithms/src/LoadDNSSCD.cpp
with
13 additions
and
13 deletions
Framework/MDAlgorithms/src/LoadDNSSCD.cpp
+
13
−
13
View file @
7c02c8ca
#include
<regex>
#include
<map>
#include
<iterator>
#include
<iomanip>
...
...
@@ -346,9 +345,10 @@ void LoadDNSSCD::updateProperties(API::Run &run,
TimeSeriesProperty
<
T
>
*
timeSeries
(
nullptr
);
std
::
string
name
(
it
->
first
);
std
::
string
units
;
std
::
regex
reg
(
"([a-zA-Z-_]+)
\\
[(.*)]"
);
std
::
smatch
match
;
if
(
std
::
regex_search
(
name
,
match
,
reg
)
&&
match
.
size
()
>
2
)
{
// std::regex does not work for rhel7, thus boost
boost
::
regex
reg
(
"([-_a-zA-Z]+)
\\
[(.*)]"
);
boost
::
smatch
match
;
if
(
boost
::
regex_search
(
name
,
match
,
reg
)
&&
match
.
size
()
>
2
)
{
std
::
string
new_name
(
match
.
str
(
1
));
units
.
assign
(
match
.
str
(
2
));
name
=
new_name
;
...
...
@@ -506,9 +506,9 @@ void LoadDNSSCD::read_data(const std::string fname,
std
::
string
line
;
std
::
string
::
size_type
n
;
std
::
string
s
;
st
d
::
regex
reg1
(
"^#
\\
s+(
\\
w+):(.*)"
);
st
d
::
regex
reg2
(
"^#
\\
s+((
\\
w+
\\
s)+)
\\
s+(-?
\\
d+(,
\\
d+)*(
\\
.
\\
d+(e
\\
d+)?)?)"
);
st
d
::
smatch
match
;
boo
st
::
regex
reg1
(
"^#
\\
s+(
\\
w+):(.*)"
);
boo
st
::
regex
reg2
(
"^#
\\
s+((
\\
w+
\\
s)+)
\\
s+(-?
\\
d+(,
\\
d+)*(
\\
.
\\
d+(e
\\
d+)?)?)"
);
boo
st
::
smatch
match
;
getline
(
file
,
line
);
n
=
line
.
find
(
"DNS"
);
if
(
n
==
std
::
string
::
npos
)
{
...
...
@@ -529,13 +529,13 @@ void LoadDNSSCD::read_data(const std::string fname,
while
(
getline
(
file
,
line
))
{
n
=
line
.
find
(
"Lambda"
);
if
(
n
!=
std
::
string
::
npos
)
{
st
d
::
regex
re
(
"[
\\
s]+"
);
boo
st
::
regex
re
(
"[
\\
s]+"
);
s
=
line
.
substr
(
5
);
st
d
::
sregex_token_iterator
it
(
s
.
begin
(),
s
.
end
(),
re
,
-
1
);
st
d
::
sregex_token_iterator
reg_end
;
boo
st
::
sregex_token_iterator
it
(
s
.
begin
(),
s
.
end
(),
re
,
-
1
);
boo
st
::
sregex_token_iterator
reg_end
;
getline
(
file
,
line
);
std
::
string
s2
=
line
.
substr
(
2
);
st
d
::
sregex_token_iterator
it2
(
s2
.
begin
(),
s2
.
end
(),
re
,
-
1
);
boo
st
::
sregex_token_iterator
it2
(
s2
.
begin
(),
s2
.
end
(),
re
,
-
1
);
for
(;
(
it
!=
reg_end
)
&&
(
it2
!=
reg_end
);
++
it
)
{
std
::
string
token
(
it
->
str
());
if
(
token
.
find_first_not_of
(
' '
)
==
std
::
string
::
npos
)
{
...
...
@@ -558,10 +558,10 @@ void LoadDNSSCD::read_data(const std::string fname,
str_metadata
.
insert
(
std
::
make_pair
(
"stop_time"
,
parseTime
(
line
)));
getline
(
file
,
line
);
}
if
(
st
d
::
regex_search
(
line
,
match
,
reg1
)
&&
match
.
size
()
>
2
)
{
if
(
boo
st
::
regex_search
(
line
,
match
,
reg1
)
&&
match
.
size
()
>
2
)
{
str_metadata
.
insert
(
std
::
make_pair
(
match
.
str
(
1
),
match
.
str
(
2
)));
}
if
(
st
d
::
regex_search
(
line
,
match
,
reg2
)
&&
match
.
size
()
>
2
)
{
if
(
boo
st
::
regex_search
(
line
,
match
,
reg2
)
&&
match
.
size
()
>
2
)
{
s
=
match
.
str
(
1
);
s
.
erase
(
std
::
find_if_not
(
s
.
rbegin
(),
s
.
rend
(),
::
isspace
).
base
(),
s
.
end
());
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment