Disk ARchive  2.6.6
Full featured and portable backup and archiving tool
mycurl_shared_handle.hpp
Go to the documentation of this file.
1 /*********************************************************************/
2 // dar - disk archive - a backup/restoration program
3 // Copyright (C) 2002-2019 Denis Corbin
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 //
19 // to contact the author : http://dar.linux.free.fr/email.html
20 /*********************************************************************/
21 
25 
26 #ifndef MYCURL_SHARED_HANDLE_HPP
27 #define MYCURL_SHARED_HANDLE_HPP
28 
29 #include "../my_config.h"
30 
31 extern "C"
32 {
33 } // end extern "C"
34 
35 #include <string>
36 #include "erreurs.hpp"
37 #include "smart_pointer.hpp"
39 
40 namespace libdar
41 {
44 
45 #if LIBCURL_AVAILABLE
46 
47 
49 
53 
54  class mycurl_shared_handle
55  {
56  public:
58  mycurl_shared_handle(const smart_pointer<mycurl_easyhandle_node> & node);
59 
61  mycurl_shared_handle(const mycurl_shared_handle & ref) = delete;
62 
64  mycurl_shared_handle(mycurl_shared_handle && arg) noexcept;
65 
67  mycurl_shared_handle & operator = (const mycurl_shared_handle & ref) = delete;
68 
70  mycurl_shared_handle & operator = (mycurl_shared_handle && arg) noexcept;
71 
73  ~mycurl_shared_handle() { if(!ref.is_null()) ref->set_used_mode(false); };
74 
76  CURL *get_handle() const { return ref->get_handle(); };
77 
78  private:
79  smart_pointer<mycurl_easyhandle_node> ref;
80 
81  };
82 
83 #endif
84 
86 
87 } // end of namespace
88 
89 #endif
template class implementing memory efficient smart pointer
contains all the excetion class thrown by libdar
used to optimize session creation done by libcurl
libdar namespace encapsulate all libdar symbols
Definition: archive.hpp:46