Program: gdcm
Module: $RCSfile: gdcmDirList.cxx,v $
Language: C++
- Date: $Date: 2004/10/12 04:35:45 $
- Version: $Revision: 1.23 $
+ Date: $Date: 2004/10/27 22:58:06 $
+ Version: $Revision: 1.24 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include <sys/stat.h>
#include <sys/types.h>
#endif
+
namespace gdcm
{
-
// Constructor / Destructor
/**
* \ingroup DirList
* @param dirName root directory name
* @param recursive whether we want to explore recursively or not
*/
-DirList::DirList(std::string dirName, bool recursive)
+DirList::DirList(std::string const & dirName, bool recursive)
{
name = dirName;
Util::NormalizePath(name);
* \brief Get the directory name
* @return the directory name
*/
-std::string DirList::GetDirName()
+std::string const & DirList::GetDirName() const
{
return name;
}
* @param dirName directory to explore
* @param recursive whether we want recursion or not
*/
-int DirList::Explore(std::string dirName, bool recursive)
+int DirList::Explore(std::string const & dirName, bool recursive)
{
int numberOfFiles = 0;
std::string fileName;
Util::NormalizePath(dirName);
-#if defined(_MSC_VER) || (__CYGWIN__)
+#if defined(_MSC_VER) || defined(__CYGWIN__)
WIN32_FIND_DATA fileData;
HANDLE hFile=FindFirstFile((dirName+"*").c_str(),&fileData);
int found = true;
Program: gdcm
Module: $RCSfile: gdcmDirList.h,v $
Language: C++
- Date: $Date: 2004/10/16 14:34:12 $
- Version: $Revision: 1.12 $
+ Date: $Date: 2004/10/27 22:58:06 $
+ Version: $Revision: 1.13 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include <string>
#include <list>
+
namespace gdcm
{
*/
// NOTE: Due to a VC6 'feature' we can not export a std::list in a dll,
// so GDCM_EXPORT keyword was removed for this class only
+
class DirList: public std::list<std::string>
{
public :
- DirList(std::string dirName,bool recursive=false);
+ DirList(std::string const & dirName, bool recursive=false);
virtual ~DirList();
- std::string GetDirName();
+ std::string const & GetDirName() const;
/// Character '\'
static const char SEPARATOR_X;
static const std::string SEPARATOR;
private :
- int Explore(std::string dirName,bool recursive=false);
+ int Explore(std::string const & dirName, bool recursive=false);
+
/// name of the root directory to explore
std::string name;
};
Program: gdcm
Module: $RCSfile: gdcmUtil.cxx,v $
Language: C++
- Date: $Date: 2004/10/25 04:47:43 $
- Version: $Revision: 1.55 $
+ Date: $Date: 2004/10/27 22:58:06 $
+ Version: $Revision: 1.56 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
* \brief Add a SEPARATOR to the end of the name is necessary
* @param name file/directory name to normalize
*/
-void Util::NormalizePath(std::string &name)
+std::string Util::NormalizePath(std::string const & pathname)
{
const char SEPARATOR_X = '/';
const char SEPARATOR_WIN = '\\';
const std::string SEPARATOR = "/";
+ std::string name = pathname;
int size = name.size();
if( name[size-1] != SEPARATOR_X && name[size-1] != SEPARATOR_WIN )
{
name += SEPARATOR;
}
+ return name;
}
/**
Program: gdcm
Module: $RCSfile: gdcmUtil.h,v $
Language: C++
- Date: $Date: 2004/10/25 04:47:43 $
- Version: $Revision: 1.37 $
+ Date: $Date: 2004/10/27 22:58:06 $
+ Version: $Revision: 1.38 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
const std::string& subStr);
static std::string CreateCleanString(std::string const & s);
- static void NormalizePath(std::string &name);
+ static std::string NormalizePath(std::string const & name);
static std::string GetPath(std::string const &fullName);
static std::string GetName(std::string const &fullName);
};