xtd 0.2.0
Loading...
Searching...
No Matches
prompt_event_args.hpp
Go to the documentation of this file.
1
4#pragma once
5#include "prompt.hpp"
7#include "../../optional.hpp"
10#include <functional>
11
13namespace xtd {
15 namespace speech {
17 namespace synthesis {
21
37 class prompt_event_args : public xtd::event_args {
38 friend class speech_synthesizer;
39 public:
41 prompt_event_args(const prompt_event_args&) = default;
42 prompt_event_args(prompt_event_args&&) = default;
43 auto operator =(const prompt_event_args&) -> prompt_event_args& = default;
44 auto operator =(prompt_event_args&&) -> prompt_event_args& = default;
46
48
52 [[nodiscard]] auto cancelled() const noexcept -> bool {return cancelled_;}
53
56 [[nodiscard]] auto error() const noexcept -> std::optional<xtd::ref<const xtd::system_exception>> {return error_ ? std::optional<xtd::ref<const xtd::system_exception >> (*error_) : std::nullopt; }
57
60 [[nodiscard]] auto prompt() const noexcept -> const xtd::speech::synthesis::prompt& {return *prompt_;}
61
64 [[nodiscard]] auto user_state() const noexcept -> xtd::any_object {return user_state_;}
66
67 private:
69 prompt_event_args(bool cancelled, const xtd::system_exception* error, xtd::speech::synthesis::prompt* prompt) : cancelled_(cancelled), error_(error), prompt_(prompt) {}
70
71 bool cancelled_ = false;
72 const xtd::system_exception* error_ = nullptr;
73 xtd::speech::synthesis::prompt* prompt_ = nullptr;
74 xtd::any_object user_state_;
75 };
76 }
77 }
78}
Contains xtd::any_object class.
Represent a polymorphic wrapper capable of holding any type.
Definition any_object.hpp:29
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition event_args.hpp:18
Provides data for the method_name_completed event.
Definition prompt_event_args.hpp:37
auto user_state() const noexcept -> xtd::any_object
Gets the unique identifier for the asynchronous task.
Definition prompt_event_args.hpp:64
auto error() const noexcept -> std::optional< xtd::ref< const xtd::system_exception > >
Gets a value indicating which error occurred during an asynchronous operation.
Definition prompt_event_args.hpp:56
auto cancelled() const noexcept -> bool
Gets a value indicating whether an asynchronous operation has been canceled.
Definition prompt_event_args.hpp:52
auto prompt() const noexcept -> const xtd::speech::synthesis::prompt &
Gets the prompt associated with the event.
Definition prompt_event_args.hpp:60
Represents information about what can be rendered, either text or an audio file, by the xtd::speech::...
Definition prompt.hpp:36
Provides access to the functionality of an installed speech synthesis engine.
Definition speech_synthesizer.hpp:35
The exception that is thrown when a method call is invalid for the object's current state.
Definition system_exception.hpp:18
Contains xtd::event_args event args.
xtd::reference_wrapper_object< type_t > ref
The xtd::ref object is a reference wrapper.
Definition ref.hpp:25
std::optional< type_t > optional
Represents the optional alias on std::optional.
Definition optional.hpp:26
Contains classes for initializing and configuring a speech synthesis engine, for creating prompts,...
Definition prompt.hpp:13
The xtd::speech namespace contains all classes and namespace to access speech technology.
Definition prompt.hpp:11
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
Contains xtd::optional type.
Contains xtd::speech::synthesis::prompt class.
Contains xtd::system_exception exception.