no throw file open

git-svn-id: https://profuse.googlecode.com/svn/branches/v2@250 aa027e90-d47c-11dd-86d7-074df07e0730
This commit is contained in:
ksherlock 2010-05-21 18:51:00 +00:00
parent ca431e43f9
commit a7a625dc3f
2 changed files with 17 additions and 0 deletions

View File

@ -26,6 +26,16 @@ File::File(File& f)
f._fd = -1;
}
File::File(const char *name, int flags, const std::nothrow_t&)
{
_fd = ::open(name, flags);
}
File::File(const char *name, bool readOnly, const std::nothrow_t&)
{
_fd = ::open(name, readOnly ? O_RDONLY : O_RDWR);
}
File::File(const char *name, int flags)
{
#undef __METHOD__

View File

@ -1,6 +1,8 @@
#ifndef __FILE_H__
#define __FILE_H__
#include <new>
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
@ -12,8 +14,13 @@ class File {
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