1/*
2** Copyright 2003, Axel D��rfler, axeld@pinc-software.de. All rights reserved.
3** Distributed under the terms of the MIT License.
4*/
5#ifndef HANDLE_H
6#define HANDLE_H
7
8
9#include <boot/vfs.h>
10
11
12#ifdef __cplusplus
13
14class Handle : public Node {
15	public:
16		Handle(int handle, bool takeOwnership = true);
17		Handle(const char *path);
18		Handle();
19		virtual ~Handle();
20
21		status_t InitCheck();
22
23		void SetTo(int handle, bool takeOwnership = true);
24
25		virtual ssize_t ReadAt(void *cookie, off_t pos, void *buffer, size_t bufferSize);
26		virtual ssize_t WriteAt(void *cookie, off_t pos, const void *buffer, size_t bufferSize);
27
28		virtual status_t GetName(char *nameBuffer, size_t bufferSize) const;
29		virtual off_t Size() const;
30
31	protected:
32		int		fHandle;
33		bool	fOwnHandle;
34		char	*fPath;
35};
36
37#endif	/* __cplusplus */
38
39#endif	/* HANDLE_H */
40