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 <mark.roszko@gmail.com>
5  * Copyright (C) 2015 KiCad Developers, see CHANGELOG.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 
65 {
66  friend class KICAD_CURL_EASY;
67 
68 public:
77  static void Init();
78 
84  static void Cleanup();
85 
93  static const char* GetVersion()
94  {
95  return curl_version();
96  }
97 
98 
105  static std::string GetSimpleVersion();
106 };
107 
108 #endif // KICAD_CURL_H_
static void Cleanup()
Function Cleanup calls curl_global_cleanup for the application.
Definition: kicad_curl.cpp:154
Class KICAD_CURL simple wrapper class to call curl_global_init and curl_global_cleanup for KiCad...
Definition: kicad_curl.h:64
static void Init()
Function Init calls curl_global_init for the application.
Definition: kicad_curl.cpp:128
Class KICAD_CURL_EASY wrapper interface around the curl_easy API.
static const char * GetVersion()
Function GetVersion wrapper for curl_version().
Definition: kicad_curl.h:93
static std::string GetSimpleVersion()
Function GetSimpleVersion Reports back curl version only and SSL library support. ...
Definition: kicad_curl.cpp:189