mirror of
https://github.com/telegramdesktop/tdesktop
synced 2024-12-29 01:52:48 +00:00
Use mapbox::util::variant in a submodule.
While we don't have C++17 std::variant<> use a BSD licensed alternative from mapbox team in a base:: wrapper.
This commit is contained in:
parent
7da52bd3ec
commit
eaae662b7d
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,3 +1,6 @@
|
||||
[submodule "third_party/GSL"]
|
||||
path = third_party/GSL
|
||||
url = https://github.com/Microsoft/GSL.git
|
||||
[submodule "third_party/variant"]
|
||||
path = third_party/variant
|
||||
url = https://github.com/mapbox/variant
|
||||
|
@ -32,6 +32,7 @@ The source code is published under GPLv3 with OpenSSL exception, the license is
|
||||
* Opus codec ([BSD license](http://www.opus-codec.org/license/))
|
||||
* FFmpeg ([LGPL](https://www.ffmpeg.org/legal.html))
|
||||
* Guideline Support Library ([MIT License](https://github.com/Microsoft/GSL/blob/master/LICENSE))
|
||||
* Mapbox Variant ([BSD license](https://github.com/mapbox/variant/blob/master/LICENSE))
|
||||
* Open Sans font ([Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0.html))
|
||||
|
||||
## Build instructions
|
||||
|
36
Telegram/SourceFiles/core/variant.h
Normal file
36
Telegram/SourceFiles/core/variant.h
Normal file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
It is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
In addition, as a special exception, the copyright holders give permission
|
||||
to link the code of portions of this program with the OpenSSL library.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <mapbox/variant.hpp>
|
||||
|
||||
// We use base::variant<> alias and base::get_if() helper while we don't have std::variant<>.
|
||||
namespace base {
|
||||
|
||||
template <typename... Types>
|
||||
using variant = mapbox::util::variant<Types...>;
|
||||
|
||||
template <typename T, typename... Types>
|
||||
inline T *get_if(variant<Types...> *v) {
|
||||
return (v && v->is<T>()) ? &v->get_unchecked<T>() : nullptr;
|
||||
}
|
||||
|
||||
} // namespace base
|
@ -96,6 +96,7 @@
|
||||
'<(minizip_loc)',
|
||||
'<(sp_media_key_tap_loc)',
|
||||
'<(submodules_loc)/GSL/include',
|
||||
'<(submodules_loc)/variant/include',
|
||||
],
|
||||
'sources': [
|
||||
'<@(qrc_files)',
|
||||
@ -178,6 +179,7 @@
|
||||
'<(src_loc)/core/type_traits.h',
|
||||
'<(src_loc)/core/utils.cpp',
|
||||
'<(src_loc)/core/utils.h',
|
||||
'<(src_loc)/core/variant.h',
|
||||
'<(src_loc)/core/version.h',
|
||||
'<(src_loc)/core/virtual_method.h',
|
||||
'<(src_loc)/core/zlib_help.h',
|
||||
|
1
third_party/variant
vendored
Submodule
1
third_party/variant
vendored
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 916139a2e51e125816efce6e19d428385601273f
|
Loading…
Reference in New Issue
Block a user