xtd 0.2.0
Loading...
Searching...
No Matches
prompt_event_args.h
Go to the documentation of this file.
1
4#pragma once
5#include "prompt.h"
6#include "../../any.h"
7#include "../../optional.h"
8#include "../../event_args.h"
9#include "../../system_exception.h"
10#include <functional>
11
13namespace xtd {
15 namespace speech {
17 namespace synthesis {
19 class speech_synthesizer;
21
36 friend class speech_synthesizer;
37 public:
39 prompt_event_args(const prompt_event_args&) = default;
41 prompt_event_args& operator =(const prompt_event_args&) = default;
43
45
49 bool cancelled() const noexcept {return cancelled_;}
50
53 std::optional<std::reference_wrapper<const xtd::system_exception>> error() const noexcept {return error_ ? std::optional<std::reference_wrapper<const xtd::system_exception>>(*error_) : std::nullopt; }
54
57 const xtd::speech::synthesis::prompt& prompt() const noexcept {return *prompt_;}
58
61 std::any user_state() const noexcept {return user_state_;}
63
64 private:
65 prompt_event_args(bool cancelled, const xtd::system_exception* error, xtd::speech::synthesis::prompt* prompt, std::any user_state) : cancelled_(cancelled), error_(error), prompt_(prompt), user_state_(user_state) {}
66 prompt_event_args(bool cancelled, const xtd::system_exception* error, xtd::speech::synthesis::prompt* prompt) : cancelled_(cancelled), error_(error), prompt_(prompt) {}
67
68 bool cancelled_ = false;
69 const xtd::system_exception* error_ = nullptr;
70 xtd::speech::synthesis::prompt* prompt_ = nullptr;
71 std::any user_state_;
72 };
73 }
74 }
75}
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition event_args.h:18
Provides data for the method_name_completed event.
Definition prompt_event_args.h:35
std::optional< std::reference_wrapper< const xtd::system_exception > > error() const noexcept
Gets a value indicating which error occurred during an asynchronous operation.
Definition prompt_event_args.h:53
std::any user_state() const noexcept
Gets the unique identifier for the asynchronous task.
Definition prompt_event_args.h:61
bool cancelled() const noexcept
Gets a value indicating whether an asynchronous operation has been canceled.
Definition prompt_event_args.h:49
const xtd::speech::synthesis::prompt & prompt() const noexcept
Gets the prompt associated with the event.
Definition prompt_event_args.h:57
Represents information about what can be rendered, either text or an audio file, by the xtd::speech::...
Definition prompt.h:34
Provides access to the functionality of an installed speech synthesis engine.
Definition speech_synthesizer.h:33
Defines the base class for predefined exceptions in the xtd namespace.
Definition system_exception.h:25
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
Contains xtd::speech::synthesis::prompt class.