KiCad PCB EDA Suite
kicad_curl.h
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2015 Mark Roszko <[email protected]>
5  * Copyright (C) 2015, 2021 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 3
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 #ifndef KICAD_CURL_H_
25 #define KICAD_CURL_H_
26 
27 /*
28  * KICAD_CURL.h must be included before wxWidgets because on Windows,
29  * wxWidgets ends up including windows.h before winsocks2.h inside curl
30  * this causes build warnings
31  * Because we are before wx, we must explicitly define we are building with unicode.
32  * wxWidgets defaults to supporting unicode now, so this should be safe.
33  */
34 #if defined(_WIN32)
35  #ifndef UNICODE
36  # define UNICODE
37  #endif
38 
39  #ifndef _UNICODE
40  # define _UNICODE
41  #endif
42 #endif
43 
44 #include <curl/curl.h>
45 #include <string>
46 
47 // CURL_EXTERN expands to dllimport on MinGW which causes gcc warnings. This really should
48 // expand to nothing on MinGW.
49 #if defined( __MINGW32__)
50 # if defined( CURL_EXTERN )
51 # undef CURL_EXTERN
52 # define CURL_EXTERN
53 # endif
54 #endif
55 
56 
57 struct DYN_LOOKUP;
58 
59 
64 {
65 public:
73  static void Init();
74 
79  static void Cleanup();
80 
87  static const char* GetVersion()
88  {
89  return curl_version();
90  }
91 
92 
98  static std::string GetSimpleVersion();
99 
100 private:
101  friend class KICAD_CURL_EASY;
102 };
103 
104 #endif // KICAD_CURL_H_
static void Cleanup()
Call curl_global_cleanup for the application.
Definition: kicad_curl.cpp:72
Simple wrapper class to call curl_global_init and curl_global_cleanup for KiCad.
Definition: kicad_curl.h:63
static void Init()
Call curl_global_init for the application.
Definition: kicad_curl.cpp:50
static const char * GetVersion()
Wrapper for curl_version().
Definition: kicad_curl.h:87
static std::string GetSimpleVersion()
Report back curl version only and SSL library support.
Definition: kicad_curl.cpp:105