KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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-2024 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 <kicommon.h>
45#include <curl/curl.h>
46#include <string>
47#include <shared_mutex>
48
49// CURL_EXTERN expands to dllimport on MinGW which causes gcc warnings. This really should
50// expand to nothing on MinGW.
51#if defined( __MINGW32__)
52# if defined( CURL_EXTERN )
53# undef CURL_EXTERN
54# define CURL_EXTERN
55# endif
56#endif
57
62{
63public:
71 static void Init();
72
77 static void Cleanup();
78
83 static std::shared_mutex& Mutex();
84
88 static bool IsShuttingDown();
89
96 static const char* GetVersion()
97 {
98 return curl_version();
99 }
100};
101
102#endif // KICAD_CURL_H_
Simple wrapper class to call curl_global_init and curl_global_cleanup for KiCad.
Definition: kicad_curl.h:62
static const char * GetVersion()
Wrapper for curl_version().
Definition: kicad_curl.h:96
#define KICOMMON_API
Definition: kicommon.h:28