]> Creatis software - gdcm.git/blob - src/gdcmDirList.h
* Improvement #2 : the CommandManager is now a static class so,
[gdcm.git] / src / gdcmDirList.h
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmDirList.h,v $
5   Language:  C++
6   Date:      $Date: 2005/11/28 16:31:23 $
7   Version:   $Revision: 1.29 $
8                                                                                 
9   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10   l'Image). All rights reserved. See Doc/License.txt or
11   http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
12                                                                                 
13      This software is distributed WITHOUT ANY WARRANTY; without even
14      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15      PURPOSE.  See the above copyright notices for more information.
16                                                                                 
17 =========================================================================*/
18
19 #ifndef GDCMDIRLIST_H
20 #define GDCMDIRLIST_H
21
22 #include "gdcmBase.h"
23
24 #include <string>
25 #include <vector>
26 #include <iostream>
27
28 namespace gdcm 
29 {
30
31 typedef std::vector<std::string> DirListType;
32
33 //-----------------------------------------------------------------------------
34
35 // NOTE: Due to a M$VC6 'feature' we cannot export a std::list in a dll, 
36 // so GDCM_EXPORT keyword was removed for this class only
37
38 /**
39  * \brief   List containing the file headers of all the 'gdcm readable' files
40  *          found by exploring (possibely recursively) a root directory. 
41  */
42 class GDCM_EXPORT DirList : public Base
43 {
44 public :
45    DirList(std::string const &dirName, bool recursive=false);
46    ~DirList();
47
48    void Print(std::ostream &os = std::cout);
49
50    /// Return the name of the directory
51    std::string const &GetDirName() const { return DirName; }
52
53    /// Return the file names
54    DirListType const &GetFilenames() const { return Filenames; }
55
56    static bool IsDirectory(std::string const &dirName);
57
58 private :
59    int Explore(std::string const &dirName, bool recursive=false);
60
61    /// List of file names
62    DirListType Filenames;
63    /// name of the root directory to explore
64    std::string DirName;
65 };
66 } // end namespace gdcm
67 //-----------------------------------------------------------------------------
68 #endif