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