GDCM  2.4.5
gdcmDirectory.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: GDCM (Grassroots DICOM). A DICOM library
4 
5  Copyright (c) 2006-2011 Mathieu Malaterre
6  All rights reserved.
7  See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without even
10  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  PURPOSE. See the above copyright notice for more information.
12 
13 =========================================================================*/
14 #ifndef GDCMDIRECTORY_H
15 #define GDCMDIRECTORY_H
16 
17 #include "gdcmTypes.h"
18 
19 #include <string>
20 #include <vector>
21 #include <iostream>
22 #include <assert.h>
23 
24 namespace gdcm
25 {
41 //-----------------------------------------------------------------------------
43 {
44  friend std::ostream& operator<<(std::ostream &_os, const Directory &d);
45 public :
46  Directory() {}
48  typedef std::string FilenameType;
49  typedef std::vector<FilenameType> FilenamesType;
50 
52  void Print(std::ostream &os = std::cout) const;
53 
55  FilenameType const &GetToplevel() const { return Toplevel; }
56 
58  FilenamesType const &GetFilenames() const {
59  assert( !(Toplevel.empty()) && "Need to call Explore first" );
60  return Filenames; }
61 
63  FilenamesType const &GetDirectories() const { return Directories; }
64 
67  unsigned int Load(FilenameType const &name, bool recursive = false);
68 
69  // \todo later: GLOB
70  // The glob() function searches for all the pathnames matching pattern according to
71  // the rules used by the shell (see glob(7)). No tilde expansion or parameter
72  // substitution is done; if you want these, use wordexp(3).
73  // int Glob(...);
74 
75 protected:
77  unsigned int Explore(FilenameType const &name, bool recursive);
78 
79 private :
81  FilenamesType Filenames;
82  FilenamesType Directories;
83 
85  FilenameType Toplevel;
86 };
87 //-----------------------------------------------------------------------------
88 inline std::ostream& operator<<(std::ostream &os, const Directory &d)
89 {
90  d.Print( os );
91  return os;
92 }
93 
94 } // end namespace gdcm
95 //-----------------------------------------------------------------------------
96 #endif //GDCMDIRECTORY_H
FilenamesType const & GetFilenames() const
Set/Get the file names within the directory.
Definition: gdcmDirectory.h:58
Class for manipulation directories.
Definition: gdcmDirectory.h:42
#define GDCM_EXPORT
Definition: gdcmWin32.h:34
std::ostream & operator<<(std::ostream &os, const Directory &d)
Definition: gdcmDirectory.h:88
std::vector< FilenameType > FilenamesType
Definition: gdcmDirectory.h:49
Directory()
Definition: gdcmDirectory.h:46
FilenamesType const & GetDirectories() const
Return the Directories traversed.
Definition: gdcmDirectory.h:63
void Print(std::ostream &os=std::cout) const
Print.
std::string FilenameType
Definition: gdcmDirectory.h:48
Definition: gdcmASN1.h:20
FilenameType const & GetToplevel() const
Get the name of the toplevel directory.
Definition: gdcmDirectory.h:55
~Directory()
Definition: gdcmDirectory.h:47

Generated on Fri Sep 25 2015 17:58:22 for GDCM by doxygen 1.8.9.1
SourceForge.net Logo