From 7b74a07adcaae71908b0c8cef12a47447cba2c58 Mon Sep 17 00:00:00 2001 From: jpr Date: Wed, 15 Nov 2006 15:53:08 +0000 Subject: [PATCH] To please python : -> remove default value for constructor. -> add Get/Set accessors --- src/gdcmDirList.cxx | 31 +++++++++++++++++++++++++++++-- src/gdcmDirList.h | 20 +++++++++++++++----- 2 files changed, 44 insertions(+), 7 deletions(-) diff --git a/src/gdcmDirList.cxx b/src/gdcmDirList.cxx index c2e6a8ab..badef729 100644 --- a/src/gdcmDirList.cxx +++ b/src/gdcmDirList.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDirList.cxx,v $ Language: C++ - Date: $Date: 2006/05/12 09:36:09 $ - Version: $Revision: 1.59 $ + Date: $Date: 2006/11/15 15:53:08 $ + Version: $Revision: 1.60 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -83,6 +83,33 @@ bool DirList::IsDirectory(std::string const &dirName) } } +/** + * \brief Get the first entry while visiting Filenames + * \return The first if found, otherwhise "" + */ +std::string DirList::GetFirst() +{ + ItDirList = Filenames.begin(); + if (ItDirList != Filenames.end()) + return *ItDirList; + return ""; +} + +/** + * \brief Get the next entry while visiting Filenames + * \return The next if found, otherwhise "" + */ +std::string DirList::GetNext() +{ + gdcmAssertMacro (ItDirList != Filenames.end()) + { + ++ItDirList; + if (ItDirList != Filenames.end()) + return *ItDirList; + } + return ""; +} + //----------------------------------------------------------------------------- // Protected diff --git a/src/gdcmDirList.h b/src/gdcmDirList.h index e907f49a..2362a8e5 100644 --- a/src/gdcmDirList.h +++ b/src/gdcmDirList.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDirList.h,v $ Language: C++ - Date: $Date: 2006/02/16 20:06:14 $ - Version: $Revision: 1.31 $ + Date: $Date: 2006/11/15 15:53:08 $ + Version: $Revision: 1.32 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -25,7 +25,7 @@ #include #include -namespace gdcm +namespace gdcm { typedef std::vector DirListType; @@ -42,7 +42,7 @@ typedef std::vector DirListType; class GDCM_EXPORT DirList : public Base { public : - DirList(std::string const &dirName, bool recursive=false); + DirList(std::string const &dirName, bool recursive); ~DirList(); void Print(std::ostream &os = std::cout, std::string const &indent = "" ); @@ -52,9 +52,15 @@ public : /// Return the file names DirListType const &GetFilenames() const { return Filenames; } + + /// Return the number of Files + int GetSize() const { return Filenames.size(); } static bool IsDirectory(std::string const &dirName); - + + std::string GetFirst(); + std::string GetNext(); + private : int Explore(std::string const &dirName, bool recursive=false); @@ -62,6 +68,10 @@ private : DirListType Filenames; /// name of the root directory to explore std::string DirName; + + /// iterator on the SQItems of the current SeqEntry + DirListType::iterator ItDirList; + }; } // end namespace gdcm //----------------------------------------------------------------------------- -- 2.48.1