Elm  2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
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> // TODO find a way to remove
25 #include <elm/util/LockPtr.h>
26 #include <elm/sys/Path.h>
27 #include <elm/sys/SystemException.h>
28 
29 namespace elm { namespace sys {
30 
31 // External
32 class File;
33 class Directory;
34 
35 // FileItem class
36 class FileItem: public Lock {
37  friend class LockPtr<FileItem>;
38 public:
40 
41  virtual LockPtr<File> toFile();
43  String name();
44  Path& path();
45  bool isReadable();
46  bool isWritable();
47  bool isDeletable();
48 
49 protected:
52  ino_t ino;
53  FileItem(Path path, ino_t inode);
54  virtual ~FileItem();
55 };
56 
57 } } // elm::system
58 
59 #endif // ELM_SYS_FILE_ITEM_H
elm::sys::Path
Definition: Path.h:33
elm::sys::FileItem::isReadable
bool isReadable()
Definition: system_FileItem.cpp:184
elm::Lock
Definition: LockPtr.h:29
elm::sys::FileItem::parent
Directory * parent
Definition: FileItem.h:50
elm::sys::FileItem::FileItem
FileItem(Path path, ino_t inode)
Definition: system_FileItem.cpp:76
elm::sys::FileItem::isDeletable
bool isDeletable()
Definition: system_FileItem.cpp:212
elm::sys::FileItem::isWritable
bool isWritable()
Definition: system_FileItem.cpp:198
elm::sys::FileItem::name
String name()
Definition: system_FileItem.cpp:166
elm::sys::FileItem::~FileItem
virtual ~FileItem()
Definition: system_FileItem.cpp:82
elm::sys::Directory
Definition: Directory.h:30
elm::sys::FileItem::path
Path & path()
Definition: system_FileItem.cpp:175
elm
Definition: adapter.h:26
elm::sys::FileItem::toDirectory
virtual LockPtr< Directory > toDirectory()
Definition: system_FileItem.cpp:157
elm::sys::FileItem::get
static LockPtr< FileItem > get(Path path)
Definition: system_FileItem.cpp:97
elm::sys::FileItem::_path
Path _path
Definition: FileItem.h:51
elm::String
Definition: String.h:30
elm::LockPtr
Definition: LockPtr.h:40
elm::sys::FileItem::toFile
virtual LockPtr< File > toFile()
Definition: system_FileItem.cpp:148
elm::sys::FileItem
Definition: FileItem.h:36
elm::sys::FileItem::ino
ino_t ino
Definition: FileItem.h:52