Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
f366553a
Commit
f366553a
authored
Oct 04, 2011
by
Andrey Morozov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improved some methods in the Directory class
parent
d58ff0f4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
15 deletions
+15
-15
contrib.hpp
modules/contrib/include/opencv2/contrib/contrib.hpp
+3
-3
inputoutput.cpp
modules/contrib/src/inputoutput.cpp
+12
-12
No files found.
modules/contrib/include/opencv2/contrib/contrib.hpp
View file @
f366553a
...
@@ -609,9 +609,9 @@ namespace cv
...
@@ -609,9 +609,9 @@ namespace cv
class
CV_EXPORTS
Directory
class
CV_EXPORTS
Directory
{
{
public
:
public
:
static
std
::
vector
<
std
::
string
>
GetListFiles
(
const
st
ring
&
directoryName
,
bool
addPath
=
true
);
static
std
::
vector
<
std
::
string
>
GetListFiles
(
const
st
d
::
string
&
path
,
const
std
::
string
&
exten
=
"*"
,
bool
addPath
=
true
);
static
std
::
vector
<
std
::
string
>
GetListFilesR
(
const
st
ring
&
directoryName
,
bool
addPath
=
true
);
static
std
::
vector
<
std
::
string
>
GetListFilesR
(
const
st
d
::
string
&
path
,
const
std
::
string
&
exten
=
"*"
,
bool
addPath
=
true
);
static
std
::
vector
<
std
::
string
>
GetListFolders
(
const
st
ring
&
directoryName
,
bool
addPath
=
true
);
static
std
::
vector
<
std
::
string
>
GetListFolders
(
const
st
d
::
string
&
path
,
const
std
::
string
&
exten
=
"*"
,
bool
addPath
=
true
);
};
};
}
}
...
...
modules/contrib/src/inputoutput.cpp
View file @
f366553a
...
@@ -10,16 +10,16 @@
...
@@ -10,16 +10,16 @@
namespace
cv
namespace
cv
{
{
std
::
vector
<
std
::
string
>
Directory
::
GetListFiles
(
const
string
&
directoryName
,
bool
addPath
)
std
::
vector
<
std
::
string
>
Directory
::
GetListFiles
(
const
std
::
string
&
path
,
const
std
::
string
&
exten
,
bool
addPath
)
{
{
std
::
vector
<
std
::
string
>
list
;
std
::
vector
<
std
::
string
>
list
;
list
.
clear
();
list
.
clear
();
std
::
string
path
=
directoryName
+
"/*"
;
std
::
string
path
_f
=
path
+
"/"
+
exten
;
#ifdef WIN32
#ifdef WIN32
WIN32_FIND_DATA
FindFileData
;
WIN32_FIND_DATA
FindFileData
;
HANDLE
hFind
;
HANDLE
hFind
;
hFind
=
FindFirstFile
((
LPCSTR
)
path
.
c_str
(),
&
FindFileData
);
hFind
=
FindFirstFile
((
LPCSTR
)
path
_f
.
c_str
(),
&
FindFileData
);
if
(
hFind
==
INVALID_HANDLE_VALUE
)
if
(
hFind
==
INVALID_HANDLE_VALUE
)
{
{
return
list
;
return
list
;
...
@@ -35,7 +35,7 @@ namespace cv
...
@@ -35,7 +35,7 @@ namespace cv
FindFileData
.
dwFileAttributes
==
FILE_ATTRIBUTE_READONLY
)
FindFileData
.
dwFileAttributes
==
FILE_ATTRIBUTE_READONLY
)
{
{
if
(
addPath
)
if
(
addPath
)
list
.
push_back
(
directoryName
+
"/"
+
FindFileData
.
cFileName
);
list
.
push_back
(
path
+
"/"
+
FindFileData
.
cFileName
);
else
else
list
.
push_back
(
FindFileData
.
cFileName
);
list
.
push_back
(
FindFileData
.
cFileName
);
}
}
...
@@ -62,16 +62,16 @@ namespace cv
...
@@ -62,16 +62,16 @@ namespace cv
return
list
;
return
list
;
}
}
std
::
vector
<
std
::
string
>
Directory
::
GetListFolders
(
const
st
ring
&
directoryName
,
bool
addPath
)
std
::
vector
<
std
::
string
>
Directory
::
GetListFolders
(
const
st
d
::
string
&
path
,
const
std
::
string
&
exten
,
bool
addPath
)
{
{
std
::
vector
<
std
::
string
>
list
;
std
::
vector
<
std
::
string
>
list
;
std
::
string
path
=
directoryName
+
"/*"
;
std
::
string
path
_f
=
path
+
"/"
+
exten
;
list
.
clear
();
list
.
clear
();
#ifdef WIN32
#ifdef WIN32
WIN32_FIND_DATA
FindFileData
;
WIN32_FIND_DATA
FindFileData
;
HANDLE
hFind
;
HANDLE
hFind
;
hFind
=
FindFirstFile
((
LPCSTR
)
path
.
c_str
(),
&
FindFileData
);
hFind
=
FindFirstFile
((
LPCSTR
)
path
_f
.
c_str
(),
&
FindFileData
);
if
(
hFind
==
INVALID_HANDLE_VALUE
)
if
(
hFind
==
INVALID_HANDLE_VALUE
)
{
{
return
list
;
return
list
;
...
@@ -85,7 +85,7 @@ namespace cv
...
@@ -85,7 +85,7 @@ namespace cv
strcmp
(
FindFileData
.
cFileName
,
".."
)
!=
0
)
strcmp
(
FindFileData
.
cFileName
,
".."
)
!=
0
)
{
{
if
(
addPath
)
if
(
addPath
)
list
.
push_back
(
directoryName
+
"/"
+
FindFileData
.
cFileName
);
list
.
push_back
(
path
+
"/"
+
FindFileData
.
cFileName
);
else
else
list
.
push_back
(
FindFileData
.
cFileName
);
list
.
push_back
(
FindFileData
.
cFileName
);
}
}
...
@@ -113,16 +113,16 @@ namespace cv
...
@@ -113,16 +113,16 @@ namespace cv
return
list
;
return
list
;
}
}
std
::
vector
<
std
::
string
>
Directory
::
GetListFilesR
(
const
st
ring
&
directoryName
,
bool
addPath
)
std
::
vector
<
std
::
string
>
Directory
::
GetListFilesR
(
const
st
d
::
string
&
path
,
const
std
::
string
&
exten
,
bool
addPath
)
{
{
std
::
vector
<
std
::
string
>
list
=
Directory
::
GetListFiles
(
directoryName
,
addPath
);
std
::
vector
<
std
::
string
>
list
=
Directory
::
GetListFiles
(
path
,
exten
,
addPath
);
std
::
vector
<
std
::
string
>
dirs
=
Directory
::
GetListFolders
(
directoryName
,
addPath
);
std
::
vector
<
std
::
string
>
dirs
=
Directory
::
GetListFolders
(
path
,
exten
,
addPath
);
std
::
vector
<
std
::
string
>::
const_iterator
it
;
std
::
vector
<
std
::
string
>::
const_iterator
it
;
for
(
it
=
dirs
.
begin
();
it
!=
dirs
.
end
();
++
it
)
for
(
it
=
dirs
.
begin
();
it
!=
dirs
.
end
();
++
it
)
{
{
std
::
vector
<
std
::
string
>
cl
=
Directory
::
GetListFiles
(
*
it
,
addPath
);
std
::
vector
<
std
::
string
>
cl
=
Directory
::
GetListFiles
(
*
it
,
exten
,
addPath
);
list
.
insert
(
list
.
end
(),
cl
.
begin
(),
cl
.
end
());
list
.
insert
(
list
.
end
(),
cl
.
begin
(),
cl
.
end
());
}
}
...
...
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