mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 06:35:14 +00:00
Export chat messages photos and documents.
Also rename .visit() with .match() in MTP types. Also add base::match_method() and base::match() for base::variant. Also add base::match() and .match() for base::optional_variant.
This commit is contained in:
@@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#pragma once
|
||||
|
||||
#include "base/optional.h"
|
||||
#include "base/variant.h"
|
||||
#include <rpl/map.h>
|
||||
#include <rpl/producer.h>
|
||||
#include <rpl/details/type_list.h>
|
||||
@@ -121,7 +122,7 @@ template <
|
||||
class combine_implementation_helper<producer<Values, Errors, Generators>...> {
|
||||
public:
|
||||
using CombinedValue = std::tuple<Values...>;
|
||||
using CombinedError = normalized_variant_t<Errors...>;
|
||||
using CombinedError = base::normalized_variant_t<Errors...>;
|
||||
|
||||
combine_implementation_helper(
|
||||
producer<Values, Errors, Generators> &&...producers)
|
||||
@@ -154,7 +155,7 @@ template <
|
||||
inline auto combine_implementation(
|
||||
producer<Values, Errors, Generators> &&...producers) {
|
||||
using CombinedValue = std::tuple<Values...>;
|
||||
using CombinedError = normalized_variant_t<Errors...>;
|
||||
using CombinedError = base::normalized_variant_t<Errors...>;
|
||||
|
||||
return make_producer<CombinedValue, CombinedError>(
|
||||
make_combine_implementation_helper(std::move(producers)...));
|
||||
|
@@ -8,7 +8,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#pragma once
|
||||
|
||||
#include <type_traits>
|
||||
#include "base/variant.h"
|
||||
|
||||
namespace rpl {
|
||||
namespace details {
|
||||
@@ -177,20 +176,5 @@ struct extract_to<list<Types...>, To> {
|
||||
};
|
||||
|
||||
} // namespace type_list
|
||||
|
||||
template <typename ...Types>
|
||||
struct normalized_variant {
|
||||
using list = type_list::list<Types...>;
|
||||
using distinct = type_list::distinct_t<list>;
|
||||
using type = std::conditional_t<
|
||||
type_list::size_v<distinct> == 1,
|
||||
type_list::get_t<0, distinct>,
|
||||
type_list::extract_to_t<distinct, base::variant>>;
|
||||
};
|
||||
|
||||
template <typename ...Types>
|
||||
using normalized_variant_t
|
||||
= typename normalized_variant<Types...>::type;
|
||||
|
||||
} // namespace details
|
||||
} // namespace rpl
|
||||
|
Reference in New Issue
Block a user