profuse/File/File.h
ksherlock a7a625dc3f no throw file open
git-svn-id: https://profuse.googlecode.com/svn/branches/v2@250 aa027e90-d47c-11dd-86d7-074df07e0730
2010-05-21 18:51:00 +00:00

48 lines
760 B
C++

#ifndef __FILE_H__
#define __FILE_H__
#include <new>
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
class File {
public:
File();
File(File &);
File(int fd);
File(const char *name, int flags);
File(const char *name, bool readOnly);
File(const char *name, int flags, const std::nothrow_t &);
File(const char *name, bool readOnly, const std::nothrow_t &);
~File();
bool isValid() const
{
return _fd >= 0;
}
int fd() const { return _fd; }
void close();
void adopt(File &f);
void adopt(int fd);
void swap(File &f);
private:
// could call dup() or something.
File& operator=(const File &f);
int _fd;
};
#endif