blob: cb8e95f8d065f696a7ca0671ee544ca00a7e6e75 [file] [log] [blame]
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Autogenerated from Pigeon (v5.0.1), do not edit directly.
// See also: https://pub.dev/packages/pigeon
#ifndef PIGEON_H_
#define PIGEON_H_
#include <flutter/basic_message_channel.h>
#include <flutter/binary_messenger.h>
#include <flutter/encodable_value.h>
#include <flutter/standard_message_codec.h>
#include <map>
#include <optional>
#include <string>
namespace url_launcher_windows {
// Generated class from Pigeon.
class FlutterError {
public:
explicit FlutterError(const std::string& code) : code_(code) {}
explicit FlutterError(const std::string& code, const std::string& message)
: code_(code), message_(message) {}
explicit FlutterError(const std::string& code, const std::string& message,
const flutter::EncodableValue& details)
: code_(code), message_(message), details_(details) {}
const std::string& code() const { return code_; }
const std::string& message() const { return message_; }
const flutter::EncodableValue& details() const { return details_; }
private:
std::string code_;
std::string message_;
flutter::EncodableValue details_;
};
template <class T>
class ErrorOr {
public:
ErrorOr(const T& rhs) { new (&v_) T(rhs); }
ErrorOr(const T&& rhs) { v_ = std::move(rhs); }
ErrorOr(const FlutterError& rhs) { new (&v_) FlutterError(rhs); }
ErrorOr(const FlutterError&& rhs) { v_ = std::move(rhs); }
bool has_error() const { return std::holds_alternative<FlutterError>(v_); }
const T& value() const { return std::get<T>(v_); };
const FlutterError& error() const { return std::get<FlutterError>(v_); };
private:
friend class UrlLauncherApi;
ErrorOr() = default;
T TakeValue() && { return std::get<T>(std::move(v_)); }
std::variant<T, FlutterError> v_;
};
// Generated interface from Pigeon that represents a handler of messages from
// Flutter.
class UrlLauncherApi {
public:
UrlLauncherApi(const UrlLauncherApi&) = delete;
UrlLauncherApi& operator=(const UrlLauncherApi&) = delete;
virtual ~UrlLauncherApi(){};
virtual ErrorOr<bool> CanLaunchUrl(const std::string& url) = 0;
virtual std::optional<FlutterError> LaunchUrl(const std::string& url) = 0;
// The codec used by UrlLauncherApi.
static const flutter::StandardMessageCodec& GetCodec();
// Sets up an instance of `UrlLauncherApi` to handle messages through the
// `binary_messenger`.
static void SetUp(flutter::BinaryMessenger* binary_messenger,
UrlLauncherApi* api);
static flutter::EncodableValue WrapError(std::string_view error_message);
static flutter::EncodableValue WrapError(const FlutterError& error);
protected:
UrlLauncherApi() = default;
};
} // namespace url_launcher_windows
#endif // PIGEON_H_