[gnote] implement directory_get_files
- From: Hubert Figuière <hub src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnote] implement directory_get_files
- Date: Sat, 25 Apr 2009 23:03:42 -0400 (EDT)
commit 88dc2ab4dbfd56efb4e8b114d4e86fed59e029c0
Author: Hubert Figuiere <hub figuiere net>
Date: Sat Apr 25 22:17:26 2009 -0400
implement directory_get_files
---
src/sharp/directory.cpp | 7 ++++++-
src/sharp/directory.hpp | 11 ++++++++++-
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/src/sharp/directory.cpp b/src/sharp/directory.cpp
index 514317b..3d9e016 100644
--- a/src/sharp/directory.cpp
+++ b/src/sharp/directory.cpp
@@ -49,12 +49,17 @@ namespace sharp {
++itr )
{
// is_regular() is deprecated but is_regular_file isn't in 1.34.
- if ( is_regular(*itr) && (sharp::string_to_lower(extension(*itr)) == ext) )
+ if ( is_regular(*itr) && (ext.empty() || (sharp::string_to_lower(extension(*itr)) == ext)) )
{
list.push_back(itr->string());
}
}
}
+ void directory_get_files(const std::string & dir, std::list<std::string> & files)
+ {
+ directory_get_files_with_ext(dir, "", files);
+ }
+
}
diff --git a/src/sharp/directory.hpp b/src/sharp/directory.hpp
index a4c648f..753175b 100644
--- a/src/sharp/directory.hpp
+++ b/src/sharp/directory.hpp
@@ -34,9 +34,18 @@
namespace sharp {
- void directory_get_files_with_ext(const std::string & dir, const std::string & ext,
+ /**
+ * @param dir the directory to list
+ * @param ext the extension. If empty, then all files are listed.
+ * @retval files the list of files
+ */
+ void directory_get_files_with_ext(const std::string & dir,
+ const std::string & ext,
std::list<std::string> & files);
+
+ void directory_get_files(const std::string & dir,
+ std::list<std::string> & files);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]