Elm  1.0
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Directory.h
1 /*
2  * Directory class interface
3  *
4  * This file is part of OTAWA
5  * Copyright (c) 2005-12, IRIT UPS.
6  *
7  * OTAWA is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * OTAWA is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with OTAWA; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 #ifndef ELM_SYS_DIRECTORY_H
22 #define ELM_SYS_DIRECTORY_H
23 
24 #include <elm/PreIterator.h>
25 #include <elm/sys/FileItem.h>
26 
27 namespace elm { namespace sys {
28 
29 // File class
30 class Directory: public FileItem {
31  friend class FileItem;
32  Directory(Path path, ino_t inode);
33 public:
34 
35  // Constructors
36  static Directory *make(Path path);
37 
38  // Children iterator
39  class Iterator: public PreIterator<Iterator, FileItem *> {
40  Path path;
41  void *dir;
42  FileItem *file;
43  void go(void);
44  public:
45  Iterator(Directory *directory);
46  ~Iterator(void);
47  bool ended(void) const;
48  FileItem *item(void) const;
49  void next(void);
50  };
51 
52  // Overload
53  virtual Directory *toDirectory(void);
54 };
55 
56 } } // elm::system
57 
58 #endif // ELM_SYS_DIRECTORY_H
59 
Definition: FileItem.h:35
Definition: PreIterator.h:29
Iterator(Directory *directory)
Definition: system_Directory.cpp:112
Definition: Path.h:31
bool ended(void) const
Definition: system_Directory.cpp:132
static Directory * make(Path path)
Definition: system_Directory.cpp:47
void next(void)
Definition: system_Directory.cpp:147
FileItem * item(void) const
Definition: system_Directory.cpp:139
~Iterator(void)
Definition: system_Directory.cpp:123
Path & path(void)
Definition: system_FileItem.cpp:198
virtual Directory * toDirectory(void)
Definition: system_Directory.cpp:76
Definition: Directory.h:39
Definition: Directory.h:30