LeechCraft  0.6.70-15082-g543737046d
Modular cross-platform feature rich live environment.
fdguard.h
Go to the documentation of this file.
1 /**********************************************************************
2  * LeechCraft - modular cross-platform feature rich internet client.
3  * Copyright (C) 2006-2014 Georg Rudoy
4  * Copyright (C) 2012 Maxim Ignatenko
5  *
6  * Distributed under the Boost Software License, Version 1.0.
7  * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
8  **********************************************************************/
9 
10 #pragma once
11 
12 #include "sysconfig.h"
13 
14 namespace LC::Util
15 {
16  class UTIL_SYS_API FDGuard
17  {
18  int FD_;
19  public:
20  FDGuard (const char *file, int mode);
21  FDGuard (const FDGuard&) = delete;
22  FDGuard (FDGuard&& other);
23  ~FDGuard ();
24 
25  FDGuard& operator= (const FDGuard&) = delete;
26  FDGuard& operator= (FDGuard&& other);
27 
28  explicit operator bool () const;
29  explicit (false) operator int () const;
30 
31  friend void swap (FDGuard& g1, FDGuard& g2);
32  };
33 }
UTIL_SYS_API
#define UTIL_SYS_API
Definition: sysconfig.h:16
LC::Util
Definition: icoreproxy.h:33
LC::Util::swap
void swap(FDGuard &g1, FDGuard &g2)
Definition: fdguard.cpp:58
sysconfig.h
LC::Util::FDGuard
Definition: fdguard.h:23