// C++/WinRT v2.0.250303.1 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. #pragma once #ifndef WINRT_Windows_Data_Text_2_H #define WINRT_Windows_Data_Text_2_H #include "winrt/impl/Windows.Foundation.Collections.1.h" #include "winrt/impl/Windows.Data.Text.1.h" WINRT_EXPORT namespace winrt::Windows::Data::Text { struct SelectableWordSegmentsTokenizingHandler : winrt::Windows::Foundation::IUnknown { SelectableWordSegmentsTokenizingHandler(std::nullptr_t = nullptr) noexcept {} SelectableWordSegmentsTokenizingHandler(void* ptr, take_ownership_from_abi_t) noexcept : winrt::Windows::Foundation::IUnknown(ptr, take_ownership_from_abi) {} template SelectableWordSegmentsTokenizingHandler(L lambda); template SelectableWordSegmentsTokenizingHandler(F* function); template SelectableWordSegmentsTokenizingHandler(O* object, M method); template SelectableWordSegmentsTokenizingHandler(com_ptr&& object, M method); template SelectableWordSegmentsTokenizingHandler(weak_ref&& object, LM&& lambda_or_method); template SelectableWordSegmentsTokenizingHandler(std::shared_ptr&& object, M method); template SelectableWordSegmentsTokenizingHandler(std::weak_ptr&& object, LM&& lambda_or_method); auto operator()(param::iterable const& precedingWords, param::iterable const& words) const; }; struct WordSegmentsTokenizingHandler : winrt::Windows::Foundation::IUnknown { WordSegmentsTokenizingHandler(std::nullptr_t = nullptr) noexcept {} WordSegmentsTokenizingHandler(void* ptr, take_ownership_from_abi_t) noexcept : winrt::Windows::Foundation::IUnknown(ptr, take_ownership_from_abi) {} template WordSegmentsTokenizingHandler(L lambda); template WordSegmentsTokenizingHandler(F* function); template WordSegmentsTokenizingHandler(O* object, M method); template WordSegmentsTokenizingHandler(com_ptr&& object, M method); template WordSegmentsTokenizingHandler(weak_ref&& object, LM&& lambda_or_method); template WordSegmentsTokenizingHandler(std::shared_ptr&& object, M method); template WordSegmentsTokenizingHandler(std::weak_ptr&& object, LM&& lambda_or_method); auto operator()(param::iterable const& precedingWords, param::iterable const& words) const; }; struct TextSegment { uint32_t StartPosition {}; uint32_t Length {}; }; inline bool operator==(TextSegment const& left, TextSegment const& right) noexcept { return left.StartPosition == right.StartPosition && left.Length == right.Length; } inline bool operator!=(TextSegment const& left, TextSegment const& right) noexcept { return !(left == right); } struct WINRT_IMPL_EMPTY_BASES AlternateWordForm : winrt::Windows::Data::Text::IAlternateWordForm { AlternateWordForm(std::nullptr_t) noexcept {} AlternateWordForm(void* ptr, take_ownership_from_abi_t) noexcept : winrt::Windows::Data::Text::IAlternateWordForm(ptr, take_ownership_from_abi) {} }; struct WINRT_IMPL_EMPTY_BASES SelectableWordSegment : winrt::Windows::Data::Text::ISelectableWordSegment { SelectableWordSegment(std::nullptr_t) noexcept {} SelectableWordSegment(void* ptr, take_ownership_from_abi_t) noexcept : winrt::Windows::Data::Text::ISelectableWordSegment(ptr, take_ownership_from_abi) {} }; struct WINRT_IMPL_EMPTY_BASES SelectableWordsSegmenter : winrt::Windows::Data::Text::ISelectableWordsSegmenter { SelectableWordsSegmenter(std::nullptr_t) noexcept {} SelectableWordsSegmenter(void* ptr, take_ownership_from_abi_t) noexcept : winrt::Windows::Data::Text::ISelectableWordsSegmenter(ptr, take_ownership_from_abi) {} explicit SelectableWordsSegmenter(param::hstring const& language); }; struct WINRT_IMPL_EMPTY_BASES SemanticTextQuery : winrt::Windows::Data::Text::ISemanticTextQuery { SemanticTextQuery(std::nullptr_t) noexcept {} SemanticTextQuery(void* ptr, take_ownership_from_abi_t) noexcept : winrt::Windows::Data::Text::ISemanticTextQuery(ptr, take_ownership_from_abi) {} explicit SemanticTextQuery(param::hstring const& aqsFilter); SemanticTextQuery(param::hstring const& aqsFilter, param::hstring const& filterLanguage); }; struct WINRT_IMPL_EMPTY_BASES TextConversionGenerator : winrt::Windows::Data::Text::ITextConversionGenerator { TextConversionGenerator(std::nullptr_t) noexcept {} TextConversionGenerator(void* ptr, take_ownership_from_abi_t) noexcept : winrt::Windows::Data::Text::ITextConversionGenerator(ptr, take_ownership_from_abi) {} explicit TextConversionGenerator(param::hstring const& languageTag); }; struct WINRT_IMPL_EMPTY_BASES TextPhoneme : winrt::Windows::Data::Text::ITextPhoneme { TextPhoneme(std::nullptr_t) noexcept {} TextPhoneme(void* ptr, take_ownership_from_abi_t) noexcept : winrt::Windows::Data::Text::ITextPhoneme(ptr, take_ownership_from_abi) {} }; struct WINRT_IMPL_EMPTY_BASES TextPredictionGenerator : winrt::Windows::Data::Text::ITextPredictionGenerator, impl::require { TextPredictionGenerator(std::nullptr_t) noexcept {} TextPredictionGenerator(void* ptr, take_ownership_from_abi_t) noexcept : winrt::Windows::Data::Text::ITextPredictionGenerator(ptr, take_ownership_from_abi) {} explicit TextPredictionGenerator(param::hstring const& languageTag); using winrt::Windows::Data::Text::ITextPredictionGenerator::GetCandidatesAsync; using impl::consume_t::GetCandidatesAsync; }; struct WINRT_IMPL_EMPTY_BASES TextReverseConversionGenerator : winrt::Windows::Data::Text::ITextReverseConversionGenerator, impl::require { TextReverseConversionGenerator(std::nullptr_t) noexcept {} TextReverseConversionGenerator(void* ptr, take_ownership_from_abi_t) noexcept : winrt::Windows::Data::Text::ITextReverseConversionGenerator(ptr, take_ownership_from_abi) {} explicit TextReverseConversionGenerator(param::hstring const& languageTag); }; struct UnicodeCharacters { UnicodeCharacters() = delete; static auto GetCodepointFromSurrogatePair(uint32_t highSurrogate, uint32_t lowSurrogate); static auto GetSurrogatePairFromCodepoint(uint32_t codepoint, char16_t& highSurrogate, char16_t& lowSurrogate); static auto IsHighSurrogate(uint32_t codepoint); static auto IsLowSurrogate(uint32_t codepoint); static auto IsSupplementary(uint32_t codepoint); static auto IsNoncharacter(uint32_t codepoint); static auto IsWhitespace(uint32_t codepoint); static auto IsAlphabetic(uint32_t codepoint); static auto IsCased(uint32_t codepoint); static auto IsUppercase(uint32_t codepoint); static auto IsLowercase(uint32_t codepoint); static auto IsIdStart(uint32_t codepoint); static auto IsIdContinue(uint32_t codepoint); static auto IsGraphemeBase(uint32_t codepoint); static auto IsGraphemeExtend(uint32_t codepoint); static auto GetNumericType(uint32_t codepoint); static auto GetGeneralCategory(uint32_t codepoint); }; struct WINRT_IMPL_EMPTY_BASES WordSegment : winrt::Windows::Data::Text::IWordSegment { WordSegment(std::nullptr_t) noexcept {} WordSegment(void* ptr, take_ownership_from_abi_t) noexcept : winrt::Windows::Data::Text::IWordSegment(ptr, take_ownership_from_abi) {} }; struct WINRT_IMPL_EMPTY_BASES WordsSegmenter : winrt::Windows::Data::Text::IWordsSegmenter { WordsSegmenter(std::nullptr_t) noexcept {} WordsSegmenter(void* ptr, take_ownership_from_abi_t) noexcept : winrt::Windows::Data::Text::IWordsSegmenter(ptr, take_ownership_from_abi) {} explicit WordsSegmenter(param::hstring const& language); }; } #endif