Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
openfoam
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor 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
Development
openfoam
Commits
7ab7eaa4
Commit
7ab7eaa4
authored
16 years ago
by
Mark Olesen
Browse files
Options
Downloads
Patches
Plain Diff
stringListOps - allow 'const char*' and 'const std::string&' arguments
parent
a83961a0
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/OpenFOAM/primitives/Lists/stringListOps.H
+8
-1
8 additions, 1 deletion
src/OpenFOAM/primitives/Lists/stringListOps.H
src/OpenFOAM/primitives/Lists/stringListOpsTemplates.C
+28
-12
28 additions, 12 deletions
src/OpenFOAM/primitives/Lists/stringListOpsTemplates.C
with
36 additions
and
13 deletions
src/OpenFOAM/primitives/Lists/stringListOps.H
+
8
−
1
View file @
7ab7eaa4
...
...
@@ -44,12 +44,19 @@ SourceFiles
namespace
Foam
{
//- Return list indices for strings matching the regular expression
template
<
class
StringType
>
labelList
findStrings
(
const
char
*
regexpPattern
,
const
UList
<
StringType
>&
);
//- Return list indices for strings matching the regular expression
template
<
class
StringType
>
labelList
findStrings
(
const
string
&
regexpPattern
,
const
std
::
string
&
regexpPattern
,
const
UList
<
StringType
>&
);
...
...
This diff is collapsed.
Click to expand it.
src/OpenFOAM/primitives/Lists/stringListOpsTemplates.C
+
28
−
12
View file @
7ab7eaa4
...
...
@@ -29,15 +29,35 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace
Foam
template
<
class
StringType
>
Foam
::
labelList
Foam
::
findStrings
(
const
char
*
pattern
,
const
UList
<
StringType
>&
lst
)
{
regExp
re
(
pattern
);
labelList
matched
(
lst
.
size
());
label
matchI
=
0
;
forAll
(
lst
,
elemI
)
{
if
(
re
.
match
(
lst
[
elemI
]))
{
matched
[
matchI
++
]
=
elemI
;
}
}
matched
.
setSize
(
matchI
);
return
matched
;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template
<
class
StringType
>
labelList
findStrings
Foam
::
labelList
Foam
::
findStrings
(
const
string
&
pattern
,
const
std
::
string
&
pattern
,
const
UList
<
StringType
>&
lst
)
{
...
...
@@ -59,7 +79,7 @@ labelList findStrings
template
<
class
StringType
>
labelList
findStrings
Foam
::
labelList
Foam
::
findStrings
(
const
wordRe
&
wre
,
const
UList
<
StringType
>&
lst
...
...
@@ -82,7 +102,7 @@ labelList findStrings
template
<
class
StringType
>
labelList
findStrings
Foam
::
labelList
Foam
::
findStrings
(
const
UList
<
wordRe
>&
wreLst
,
const
UList
<
StringType
>&
lst
...
...
@@ -109,7 +129,7 @@ labelList findStrings
template
<
class
StringType
>
bool
findStrings
bool
Foam
::
findStrings
(
const
UList
<
wordRe
>&
wreLst
,
const
StringType
&
str
...
...
@@ -122,13 +142,9 @@ bool findStrings
return
true
;
}
}
return
false
;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
}
// End namespace Foam
// ************************************************************************* //
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