Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
65be3e81
Commit
65be3e81
authored
Jun 18, 2011
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added match_endings to the dir_nav utils.
parent
9db07ff3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
72 additions
and
0 deletions
+72
-0
dir_nav_extensions.h
dlib/dir_nav/dir_nav_extensions.h
+35
-0
dir_nav_extensions_abstract.h
dlib/dir_nav/dir_nav_extensions_abstract.h
+37
-0
No files found.
dlib/dir_nav/dir_nav_extensions.h
View file @
65be3e81
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
#include <algorithm>
#include <algorithm>
#include "dir_nav_extensions_abstract.h"
#include "dir_nav_extensions_abstract.h"
#include "../dir_nav.h"
#include "../dir_nav.h"
#include "../string.h"
namespace
dlib
namespace
dlib
{
{
...
@@ -83,6 +84,40 @@ namespace dlib
...
@@ -83,6 +84,40 @@ namespace dlib
std
::
string
ending
;
std
::
string
ending
;
};
};
// ----------------------------------------------------------------------------------------
class
match_endings
{
public
:
match_endings
(
const
std
::
string
&
endings_
)
{
const
std
::
vector
<
std
::
string
>&
s
=
split
(
endings_
);
for
(
unsigned
long
i
=
0
;
i
<
s
.
size
();
++
i
)
{
endings
.
push_back
(
match_ending
(
s
[
i
]));
}
}
bool
operator
()
(
const
file
&
f
)
const
{
for
(
unsigned
long
i
=
0
;
i
<
endings
.
size
();
++
i
)
{
if
(
endings
[
i
](
f
))
return
true
;
}
return
false
;
}
private
:
std
::
vector
<
match_ending
>
endings
;
};
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
class
match_all
class
match_all
...
...
dlib/dir_nav/dir_nav_extensions_abstract.h
View file @
65be3e81
...
@@ -68,6 +68,43 @@ namespace dlib
...
@@ -68,6 +68,43 @@ namespace dlib
!*/
!*/
};
};
// ----------------------------------------------------------------------------------------
class
match_endings
{
/*!
WHAT THIS OBJECT REPRESENTS
This is a simple function object that can be used with the
above get_files_in_directory_tree() function. This object
allows you to look for files with a number of different
endings.
!*/
public
:
match_endings
(
const
std
::
string
&
ending_list
);
/*!
ensures
- ending_list is interpreted as a whitespace separated list
of file endings.
- this object will be a function that checks if a file has a
name that ends with one of the strings in ending_list.
!*/
bool
operator
()
(
const
file
&
f
)
const
;
/*!
ensures
- if (the file f has a name that ends with one of the ending strings
given to this object's constructor) then
- returns true
- else
- returns false
!*/
};
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
class
match_all
class
match_all
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment