2010-05-26 22:15:44 +00:00
|
|
|
#ifndef __PASCAL_ENTRY_H__
|
|
|
|
#define __PASCAL_ENTRY_H__
|
|
|
|
|
2011-03-14 23:08:19 +00:00
|
|
|
#include <Common/smart_pointers.h>
|
2010-05-26 22:15:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace Device {
|
|
|
|
class BlockDevice;
|
|
|
|
class BlockCache;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace LittleEndian {
|
|
|
|
class IOBuffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace Pascal {
|
|
|
|
|
|
|
|
|
|
|
|
enum {
|
|
|
|
kUntypedFile,
|
|
|
|
kBadBlockFile,
|
|
|
|
kCodeFile,
|
|
|
|
kTextFile,
|
|
|
|
kInfoFile,
|
|
|
|
kDataFile,
|
|
|
|
kGrafFile,
|
|
|
|
kFotoFile,
|
|
|
|
kSecureDir
|
|
|
|
};
|
|
|
|
|
|
|
|
class FileEntry;
|
|
|
|
class VolumeEntry;
|
|
|
|
|
2011-02-26 02:11:46 +00:00
|
|
|
|
2011-02-26 03:52:54 +00:00
|
|
|
typedef SHARED_PTR(FileEntry) FileEntryPointer;
|
|
|
|
typedef SHARED_PTR(VolumeEntry) VolumeEntryPointer;
|
2011-02-26 02:11:46 +00:00
|
|
|
|
2011-02-26 03:52:54 +00:00
|
|
|
typedef WEAK_PTR(FileEntry) FileEntryWeakPointer;
|
|
|
|
typedef WEAK_PTR(VolumeEntry) VolumeEntryWeakPointer;
|
2011-02-26 02:11:46 +00:00
|
|
|
|
2011-02-26 03:52:54 +00:00
|
|
|
class Entry : public ENABLE_SHARED_FROM_THIS(Entry) {
|
2010-05-26 22:15:44 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
virtual ~Entry();
|
|
|
|
|
|
|
|
unsigned blocks() const { return _lastBlock - _firstBlock; }
|
|
|
|
|
|
|
|
unsigned firstBlock() const { return _firstBlock; }
|
|
|
|
unsigned lastBlock() const { return _lastBlock; }
|
|
|
|
|
|
|
|
unsigned fileKind() const { return _fileKind; }
|
|
|
|
|
|
|
|
unsigned inode() const { return _inode; }
|
|
|
|
void setInode(unsigned inode) { _inode = inode; }
|
|
|
|
|
2011-02-26 02:11:46 +00:00
|
|
|
VolumeEntryWeakPointer parent() { return _parent; }
|
2010-05-26 22:15:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
static unsigned ValidName(const char *name, unsigned maxSize);
|
|
|
|
|
|
|
|
virtual void writeDirectoryEntry(LittleEndian::IOBuffer *);
|
|
|
|
|
|
|
|
Entry();
|
|
|
|
Entry(void *);
|
|
|
|
void init(void *);
|
|
|
|
|
|
|
|
unsigned _firstBlock;
|
|
|
|
unsigned _lastBlock;
|
|
|
|
unsigned _fileKind;
|
|
|
|
|
|
|
|
unsigned _inode;
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
friend class VolumeEntry;
|
2010-05-26 22:19:43 +00:00
|
|
|
|
2011-02-26 02:11:46 +00:00
|
|
|
VolumeEntryWeakPointer _parent;
|
2010-05-26 22:15:44 +00:00
|
|
|
unsigned _address;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|