]> Creatis software - gdcm.git/blob - src/gdcmDirList.h
171a1a6972ccf0ac011ce88fc891d845b9719d7e
[gdcm.git] / src / gdcmDirList.h
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmDirList.h,v $
5   Language:  C++
6   Date:      $Date: 2005/01/28 17:01:30 $
7   Version:   $Revision: 1.20 $
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 "gdcmCommon.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 VC6 'feature' we can not export a std::list in a dll, 
36 // so GDCM_EXPORT keyword was removed for this class only
37
38 /**
39  * \ingroup DirList
40  * \brief   List containing the file headers of all the gdcm readable files
41  *          found by exploring recursively a root directory. 
42  */
43 class GDCM_EXPORT DirList
44 {
45 public :
46    DirList(std::string const &dirName, bool recursive=false);
47    ~DirList();
48
49    /// Return the name of the directory
50    std::string const &GetDirName() const { return DirName; }
51
52    /// Return the file names
53    DirListType const &GetFilenames() const { return Filenames; };
54
55    /// Print all element of the DirList
56    void Print(std::ostream &os = std::cout);
57
58 private :
59    int Explore(std::string const &dirName, bool recursive=false);
60
61    DirListType Filenames;
62
63    /// name of the root directory to explore
64    std::string DirName;
65 };
66 } // end namespace gdcm
67 //-----------------------------------------------------------------------------
68 #endif