mirror of
https://github.com/ksherlock/profuse.git
synced 2025-08-15 05:27:25 +00:00
git-svn-id: https://profuse.googlecode.com/svn/branches/v2@230 aa027e90-d47c-11dd-86d7-074df07e0730
This commit is contained in:
@@ -71,11 +71,21 @@ void File::close()
|
|||||||
|
|
||||||
void File::adopt(File &f)
|
void File::adopt(File &f)
|
||||||
{
|
{
|
||||||
|
if (&f == this) return;
|
||||||
|
|
||||||
close();
|
close();
|
||||||
_fd = f._fd;
|
_fd = f._fd;
|
||||||
f._fd = -1;
|
f._fd = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void File::adopt(int fd)
|
||||||
|
{
|
||||||
|
if (fd == _fd) return;
|
||||||
|
close();
|
||||||
|
_fd = fd;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void File::swap(File &f)
|
void File::swap(File &f)
|
||||||
{
|
{
|
||||||
std::swap(_fd, f._fd);
|
std::swap(_fd, f._fd);
|
||||||
|
@@ -26,6 +26,8 @@ class File {
|
|||||||
void close();
|
void close();
|
||||||
|
|
||||||
void adopt(File &f);
|
void adopt(File &f);
|
||||||
|
void adopt(int fd);
|
||||||
|
|
||||||
void swap(File &f);
|
void swap(File &f);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Reference in New Issue
Block a user