Base class for all protobuf messages. 更多...
| 頭: |
#include <QProtobufMessage>
|
| CMake: |
find_package(Qt6 REQUIRED COMPONENTS Protobuf)
target_link_libraries(mytarget PRIVATE Qt6::Protobuf)
|
| Since: | Qt 6.5 |
| 繼承者: |
(從 6.8 起)
bool
|
deserialize (QAbstractProtobufSerializer * serializer , QByteArrayView data ) |
| QVariant | property (QAnyStringView propertyName ) const |
(從 6.8 起)
const QtProtobufPrivate::QProtobufPropertyOrdering *
|
propertyOrdering () const |
(從 6.8 起)
QByteArray
|
serialize (QAbstractProtobufSerializer * serializer ) const |
| bool | setProperty (QAnyStringView propertyName , const QVariant & value ) |
(從 6.6 起)
bool
|
setProperty (QAnyStringView propertyName , QVariant && value ) |
(從 6.7 起)
QList<QByteArray>
|
unknownFieldData (qint32 field ) const |
(從 6.7 起)
QList<qint32>
|
unknownFieldNumbers () const |
| QProtobufMessagePointer | constructByName (const QString & messageType ) |
| QProtobufMessagePointer |
Provides access to the properties of a message, using setProperty () 和 property (), without depending on what the message is.
[static]
QProtobufMessagePointer
QProtobufMessage::
constructByName
(const
QString
&
messageType
)
構造 QProtobufMessage 使用 messageType . Returns a pointer to the constructed QProtobufMessage .
This function attempts to create a message with a type that matches
messageType
。若
messageType
is unknown, the function returns
nullptr
. If the message is not found in the registry, the function returns
nullptr
. The function caller is given ownership of the constructed message.
[since 6.8]
bool
QProtobufMessage::
deserialize
(
QAbstractProtobufSerializer
*
serializer
,
QByteArrayView
data
)
Deserializes this protobuf message from a
QByteArray
data
使用
serializer
。返迴
true
if deserialization was successful, otherwise
false
.
該函數在 Qt 6.8 引入。
另請參閱 serialize ().
Get the value of the property propertyName .
若 propertyName isn't known then the returned QVariant 無效。
另請參閱 setProperty ().
[since 6.8]
const
QtProtobufPrivate::QProtobufPropertyOrdering
*QProtobufMessage::
propertyOrdering
() const
Returns the pointer to the property ordering of the derived protobuf message.
該函數在 Qt 6.8 引入。
[since 6.8]
QByteArray
QProtobufMessage::
serialize
(
QAbstractProtobufSerializer
*
serializer
) const
Serializes this protobuf message into a QByteArray 使用 serializer .
該函數在 Qt 6.8 引入。
另請參閱 deserialize ().
Set the property propertyName to the value stored in value .
若
propertyName
isn't a known fields, then the value is ignored, and the function returns
false
.
返迴
false
if it fails to store the
value
on the property. Otherwise
true
.
另請參閱 property ().
[since 6.6]
bool
QProtobufMessage::
setProperty
(
QAnyStringView
propertyName
,
QVariant
&&
value
)
這是重載函數。
該函數在 Qt 6.6 引入。
[since 6.7]
QList
<
QByteArray
> QProtobufMessage::
unknownFieldData
(
qint32
field
) const
Returns the unknown field values sorted as they were received from the wire.
該函數在 Qt 6.7 引入。
[since 6.7]
QList
<
qint32
> QProtobufMessage::
unknownFieldNumbers
() const
Returns the field numbers that were not known to QtProtobuf during deserialization.
該函數在 Qt 6.7 引入。
[alias]
QProtobufMessagePointer
Synonym for std::unique_ptr< QProtobufMessage , QProtobufMessageDeleter >. Use this to manage the lifetime of dynamically allocated QProtobufMessages, such as those created by calling QProtobufMessage::constructByName .