Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qohosudmf.h
Go to the documentation of this file.
1// Copyright (C) 2025 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QOHOSUDMF_H
5#define QOHOSUDMF_H
6
7#include <QtCore/private/qohoscommon_p.h>
8#include <QtCore/qglobal.h>
9#include <QtCore/qspan.h>
10#include <database/udmf/udmf_err_code.h>
11#include <database/udmf/udmf.h>
12#include <memory>
13#include <qarkui/qarkuiutils.h>
14#include <qohosplugincore.h>
15#include <qohosudsobject.h>
16#include <qohosutils.h>
17#include <string>
18#include <utility>
19#include <vector>
20
22
24{
25public:
27
32
33 std::vector<std::string> getTypes() const;
34
36 std::vector<std::string> typeIds, std::function<void *(const char *)> dataFetchFunc);
37
38 template<typename T>
39 void addEntry(QOhosUdsObject<T> udsObject);
40
41 void addGeneralEntry(const std::string &typeId, std::uint8_t *buff, std::uint32_t buffSize);
42
43 template<typename T>
45
46 QOhosOptional<QSpan<std::uint8_t>> tryGetGeneralEntry(const std::string &typeId);
47
48 bool isEmpty() const;
49
50private:
51 static QOhosUdmfRecord makeAsView(::OH_UdmfRecord *nativePtr);
52
53 QOhosUdmfRecord(std::unique_ptr<::OH_UdmfRecord, void(*)(::OH_UdmfRecord *)> &&nativePtr);
54
55 ::OH_UdmfRecord *release() &&;
56
57 std::unique_ptr<::OH_UdmfRecord, void(*)(::OH_UdmfRecord *)> m_nativePtr;
58
59 bool m_invalidated {false};
60
61 friend class QOhosUdmfData;
62};
63
65{
66public:
67 static QOhosUdmfData takeOwnership(::OH_UdmfData *nativePtr);
68
70
71 QOhosUdmfData(const QOhosUdmfData &) = delete;
75
76 std::vector<std::string> getTypes() const;
77
79 void addRecord(QOhosUdmfRecord &&record);
80
81 ::OH_UdmfData *release() &&;
83
84private:
85 QOhosUdmfData(::OH_UdmfData *nativePtr);
86
87 std::unique_ptr<::OH_UdmfData, void(*)(::OH_UdmfData *)> m_nativePtr;
88};
89
91{
92
93template<typename T>
95{
96};
97
98template<>
104
105template<>
111
112template<>
118
119template<>
125
126template<>
132
133}
134
135template<typename T>
137{
138 QArkUi::callArkUiOrFailOnErrorResult(
139 ::details_qohosudmfrecord_h::UdmfRecordMeta<T>::addContentNamedFunc(),
140 m_nativePtr.get(), udsObject.data());
141}
142
143template<typename T>
145{
146 if (m_invalidated) {
147 qOhosPrintfError(
148 "%s: This record is invalidated. Returning an entry with default content.", Q_FUNC_INFO);
149 return QOhosUdsObject<T>();
150 }
151
152 QOhosUdsObject<T> udsObject;
153 auto getContentFuncResult = details_qohosudmfrecord_h::UdmfRecordMeta<T>::getContentNamedFunc()(
154 m_nativePtr.get(), udsObject.data());
155 if (getContentFuncResult != ::Udmf_ErrCode::UDMF_E_OK) {
156 qOhosPrintfError(
157 "%s: '%s' function failed with error: %d."
158 " Any further operations done to this record will be ignored or will result in dummy values.",
159 Q_FUNC_INFO, details_qohosudmfrecord_h::UdmfRecordMeta<T>::getContentNamedFunc().name(),
160 getContentFuncResult);
161 m_invalidated = true;
162
163 return QOhosUdsObject<T>();
164 }
165
166 return udsObject;
167}
168
169QT_END_NAMESPACE
170
171#endif
static std::unique_ptr< Node > takeOwnershipOfExternalNode(::ArkUI_NodeHandle nodeHandle)
void setAttributeOrFail(::ArkUI_NodeAttributeType attributeType, bool value)
static std::unique_ptr< Node > createOrFail(::ArkUI_NodeType type)
void setAttributeOrFail(::ArkUI_NodeAttributeType attributeType, std::uint32_t value)
void setAttributeOrFail(::ArkUI_NodeAttributeType attributeType, std::int32_t value)
static QOhosOptional<::ArkUI_NodeHandle > tryfindChild(::ArkUI_NodeHandle nodeHandle, const std::function< bool(::ArkUI_NodeHandle)> predicate)
void setAttributeOrFail(::ArkUI_NodeAttributeType attributeType, const std::array< std::uint32_t, N > &value)
Node & operator=(Node &&)=delete
T getAttributeOrFail(::ArkUI_NodeAttributeType attributeType) const
void setAttributeOrFail(::ArkUI_NodeAttributeType attributeType, const std::array< float, N > &value)
void setAttributeOrFail(::ArkUI_NodeAttributeType attributeType, const std::string &value)
void setEventHandler(::ArkUI_NodeEventType eventType, std::function< void(::ArkUI_NodeEvent *)> eventHandler)
Node(Node &&)=delete
::ArkUI_NodeHandle handle() const
Node(const Node &)=delete
Node & operator=(const Node &)=delete
void removeChildOrFail(Node &child)
static bool isQtManagedNode(::ArkUI_NodeHandle nodeHandle)
void setLengthMetricUnitOrFail(::ArkUI_LengthMetricUnit unit)
void setAttributeOrFail(::ArkUI_NodeAttributeType attributeType, const std::array< std::int32_t, N > &value)
void setAttributeOrFail(::ArkUI_NodeAttributeType attributeType, float value)
void addChildOrFail(Node &child)
std::int32_t getAttributeOrFail(::ArkUI_NodeAttributeType attributeType) const
ParentDescriptor(ParentDescriptor &&)=default
ParentDescriptor(std::shared_ptr< QXComponentNode > node)
ParentDescriptor & operator=(ParentDescriptor &&)=default
std::shared_ptr< QXComponentNode > xComponentNodeOrNull() const
std::shared_ptr< QEmbeddedWindowNode > embeddedWindowNodeOrNull() const
ParentDescriptor & operator=(const ParentDescriptor &)=default
ParentDescriptor(const ParentDescriptor &)=default
bool operator==(const ParentDescriptor &) const
void setHitTestMode(::ArkUI_HitTestMode hitTestMode)
void setDragEventsHandler(QOhosConsumer<::ArkUI_NodeEventType, ::ArkUI_DragEvent * > dragEventsHandler)
void setMouseEventsHandler(QOhosConsumer<::ArkUI_UIInputEvent * > mouseEventsHandler)
QEmbeddedWindowNode & operator=(const QEmbeddedWindowNode &)=delete
void setGesturesHandler(QOhosConsumer< const NativeGestureInfo & > gesturesHandler)
void setSizeParentFillPercentageNormalized(const QSizeF &size)
void setZIndex(std::int32_t index)
void setAxisEventsHandler(QOhosConsumer<::ArkUI_UIInputEvent * > axisEventsHandler)
void setParentOrReparent(ParentDescriptor parent)
void setKeyEventsHandler(QOhosConsumer<::ArkUI_UIInputEvent * > keyEventsHandler)
QEmbeddedWindowNode(std::unique_ptr< Node > stack, std::unique_ptr< Node > contentNode, std::unique_ptr< QtOhos::WindowIdStruct > windowId)
QEmbeddedWindowNode(const QEmbeddedWindowNode &)=delete
std::shared_ptr< void > startDrag(std::vector< std::shared_ptr<::OH_PixelmapNative > > pixelMaps, const QPointF &hotspot, QOhosUdmfData udmfData, std::function< void(::ArkUI_DragAndDropInfo *)> statusListener)
static const std::int32_t minimumNodeZIndexValue
void setSize(const QSizeF &size)
void setBackgroundColor(const QColor &color)
void handleGestureEvent(const NativeGestureInfo &nativeGestureInfo) const
QEmbeddedWindowNode(QEmbeddedWindowNode &&)=delete
void setPosition(const QPointF &position)
void setHoverEventsHandler(QOhosConsumer<::ArkUI_UIInputEvent * > hoverEventsHandler)
QEmbeddedWindowNode & operator=(QEmbeddedWindowNode &&)=delete
std::enable_if_t< qohosplugincore_h_detail::isQOhosOptional< QOhosInvokeResult< Func, T > >, QOhosInvokeResult< Func, T > > andThen(Func &&func) const
static QOhosUdmfData takeOwnership(::OH_UdmfData *nativePtr)
QOhosUdmfData(QOhosUdmfData &&)=default
QOhosUdmfData(const QOhosUdmfData &)=delete
QOhosUdmfData & operator=(const QOhosUdmfData &)=delete
::OH_UdmfData * nativePtr()
std::vector< QOhosUdmfRecord > getRecords()
QOhosUdmfData & operator=(QOhosUdmfData &&)=default
void addRecord(QOhosUdmfRecord &&record)
::OH_UdmfData * release() &&
std::vector< std::string > getTypes() const
void addEntry(QOhosUdsObject< T > udsObject)
Definition qohosudmf.h:136
QOhosUdmfRecord(QOhosUdmfRecord &&)=default
void addGeneralEntry(const std::string &typeId, std::uint8_t *buff, std::uint32_t buffSize)
QOhosUdmfRecord & operator=(QOhosUdmfRecord &&)=default
QOhosUdmfRecord(const QOhosUdmfRecord &)=delete
bool isEmpty() const
QOhosOptional< QSpan< std::uint8_t > > tryGetGeneralEntry(const std::string &typeId)
QOhosUdsObject< T > getEntry()
Definition qohosudmf.h:144
QOhosUdmfRecord & operator=(const QOhosUdmfRecord &)=delete
std::vector< std::string > getTypes() const
Definition qohosudmf.cpp:80
void setProviderForDataFetchFunc(std::vector< std::string > typeIds, std::function< void *(const char *)> dataFetchFunc)
Combined button and popup list for selecting options.
QXComponent< QXComponentType::Node > QXComponentNode
Definition qxcomponent.h:44
::ArkUI_GestureEvent * event