X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmDirList.cxx;h=938dbb3fb948af4b9e65da419ad48bc8110a64c9;hb=4399e9fed374a2dcc7f1ab98ec7b5af5f7982aca;hp=d76015df920331e0e149bf18033e6241d7ab4c0a;hpb=49c0af19f5bf0f2402d37d8abf7fb139e7453245;p=gdcm.git diff --git a/src/gdcmDirList.cxx b/src/gdcmDirList.cxx index d76015df..938dbb3f 100644 --- a/src/gdcmDirList.cxx +++ b/src/gdcmDirList.cxx @@ -3,12 +3,12 @@ Program: gdcm Module: $RCSfile: gdcmDirList.cxx,v $ Language: C++ - Date: $Date: 2004/08/01 00:59:21 $ - Version: $Revision: 1.19 $ + Date: $Date: 2004/11/16 10:25:53 $ + Version: $Revision: 1.27 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or - http://www.creatis.insa-lyon.fr/Public/Gdcm/License.htm for details. + http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR @@ -22,9 +22,9 @@ #include #include -#if defined(_MSC_VER) || defined (__CYGWIN__) +#if defined(_MSC_VER) || defined (__CYGWIN__) || defined(__BORLANDC__) #include -#ifdef _MSC_VER +#if defined _MSC_VER || defined(__BORLANDC__) #include #endif //_MSC_VER #else @@ -34,25 +34,27 @@ #include #endif +namespace gdcm +{ // Constructor / Destructor /** - * \ingroup gdcmDirList + * \ingroup DirList * \brief Constructor * @param dirName root directory name * @param recursive whether we want to explore recursively or not */ -gdcmDirList::gdcmDirList(std::string dirName, bool recursive) +DirList::DirList(std::string const & dirName, bool recursive) { name = dirName; - NormalizePath(name); + Util::NormalizePath(name); Explore(name, recursive); } /** - * \ingroup gdcmDirList + * \ingroup DirList * \brief Destructor */ -gdcmDirList::~gdcmDirList() +DirList::~DirList() { } @@ -62,11 +64,11 @@ gdcmDirList::~gdcmDirList() //----------------------------------------------------------------------------- // Public /** - * \ingroup gdcmDirList + * \ingroup DirList * \brief Get the directory name * @return the directory name */ -std::string gdcmDirList::GetDirName() +std::string const & DirList::GetDirName() const { return name; } @@ -78,18 +80,17 @@ std::string gdcmDirList::GetDirName() // Private /** - * \ingroup gdcmDirList * \brief Explore a directory with possibility of recursion * return number of files read - * @param dirName directory to explore + * @param dirpath directory to explore * @param recursive whether we want recursion or not */ -int gdcmDirList::Explore(std::string dirName, bool recursive) +int DirList::Explore(std::string const & dirpath, bool recursive) { int numberOfFiles = 0; std::string fileName; - NormalizePath(dirName); -#if defined(_MSC_VER) || (__CYGWIN__) + std::string dirName = Util::NormalizePath(dirpath); +#if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__BORLANDC__) WIN32_FIND_DATA fileData; HANDLE hFile=FindFirstFile((dirName+"*").c_str(),&fileData); int found = true; @@ -135,7 +136,7 @@ int gdcmDirList::Explore(std::string dirName, bool recursive) { fileName = dirName + d->d_name; stat(fileName.c_str(), &buf); //really discard output ? - if( S_ISREG(buf.st_mode) ) //is it a regular file? + if( S_ISREG(buf.st_mode) ) //is it a regular file? { push_back( fileName ); numberOfFiles++; @@ -158,5 +159,6 @@ int gdcmDirList::Explore(std::string dirName, bool recursive) return numberOfFiles; } +} // end namespace gdcm //-----------------------------------------------------------------------------