Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cta
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
dCache
cta
Commits
12ac6a07
Commit
12ac6a07
authored
5 years ago
by
Eric Cano
Browse files
Options
Downloads
Patches
Plain Diff
#533 Added copy constructor to Regex.
parent
137e9606
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
common/utils/Regex.cpp
+7
-3
7 additions, 3 deletions
common/utils/Regex.cpp
common/utils/Regex.hpp
+4
-1
4 additions, 1 deletion
common/utils/Regex.hpp
with
11 additions
and
4 deletions
common/utils/Regex.cpp
+
7
−
3
View file @
12ac6a07
...
...
@@ -27,10 +27,10 @@
namespace
cta
{
namespace
utils
{
Regex
::
Regex
(
const
char
*
re_str
)
:
m_set
(
false
)
{
if
(
int
rc
=
::
regcomp
(
&
m_re
,
re
_str
,
REG_EXTENDED
))
{
Regex
::
Regex
(
const
std
::
string
&
re_str
)
:
m_reStr
(
re_str
),
m_set
(
false
)
{
if
(
int
rc
=
::
regcomp
(
&
m_re
,
m_reStr
.
c
_str
()
,
REG_EXTENDED
))
{
std
::
string
error
(
"Could not compile regular expression:
\"
"
);
error
+=
re_s
tr
;
error
+=
m_reS
tr
;
error
+=
"
\"
"
;
char
re_err
[
1024
];
if
(
::
regerror
(
rc
,
&
m_re
,
re_err
,
sizeof
(
re_err
)))
{
...
...
@@ -42,6 +42,10 @@ Regex::Regex(const char * re_str) : m_set(false) {
m_set
=
true
;
}
Regex
::
Regex
(
const
Regex
&
o
)
{
Regex
(
o
.
m_reStr
);
}
Regex
::~
Regex
()
{
if
(
m_set
)
::
regfree
(
&
m_re
);
...
...
This diff is collapsed.
Click to expand it.
common/utils/Regex.hpp
+
4
−
1
View file @
12ac6a07
...
...
@@ -29,7 +29,8 @@ namespace cta { namespace utils {
class
Regex
{
public:
Regex
(
const
char
*
re_str
);
Regex
(
const
std
::
string
&
re_str
);
Regex
(
const
Regex
&
o
);
virtual
~
Regex
();
/*!
...
...
@@ -45,6 +46,8 @@ class Regex {
}
private
:
// We keep around the string from which the RE was compiled to allow copying.
std
::
string
m_reStr
;
regex_t
m_re
;
bool
m_set
;
};
...
...
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