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
FileItem.h
1 /*
2  * FileItem 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_FILE_ITEM_H
22 #define ELM_SYS_FILE_ITEM_H
23 
24 #include <sys/stat.h>
25 #include <elm/sys/Path.h>
26 #include <elm/sys/SystemException.h>
27 
28 namespace elm { namespace sys {
29 
30 // External
31 class File;
32 class Directory;
33 
34 // FileItem class
35 class FileItem {
36  int usage;
37 protected:
40  ino_t ino;
41  FileItem(Path path, ino_t inode);
42  virtual ~FileItem(void);
43 public:
44  static FileItem *get(Path path) throw(SystemException);
45  void use(void);
46  void release(void);
47 
48  // Accessors
49  virtual File *toFile(void);
50  virtual Directory *toDirectory(void);
51  String name(void);
52  Path& path(void);
53  bool isReadable(void);
54  bool isWritable(void);
55  bool isDeletable(void);
56 };
57 
58 } } // elm::system
59 
60 #endif // ELM_SYS_FILE_ITEM_H
Definition: FileItem.h:35
virtual Directory * toDirectory(void)
Definition: system_FileItem.cpp:180
Definition: Path.h:31
bool isReadable(void)
Definition: system_FileItem.cpp:207
void release(void)
Definition: system_FileItem.cpp:154
virtual ~FileItem(void)
Definition: system_FileItem.cpp:84
Definition: SystemException.h:29
Path _path
Definition: FileItem.h:39
virtual File * toFile(void)
Definition: system_FileItem.cpp:171
Path & path(void)
Definition: system_FileItem.cpp:198
Definition: File.h:29
FileItem(Path path, ino_t inode)
Definition: system_FileItem.cpp:76
bool isWritable(void)
Definition: system_FileItem.cpp:221
Definition: String.h:31
Directory * parent
Definition: FileItem.h:38
String name(void)
Definition: system_FileItem.cpp:189
ino_t ino
Definition: FileItem.h:40
Definition: Directory.h:30
void use(void)
Definition: system_FileItem.cpp:145
bool isDeletable(void)
Definition: system_FileItem.cpp:235