QGrpcStatus Class

This class combines a StatusCode and a string message. More...

Header: #include <QGrpcStatus>
CMake: find_package(Qt6 REQUIRED COMPONENTS Grpc)
target_link_libraries(mytarget PRIVATE Qt6::Grpc)
Since: Qt 6.5
Status: Technical Preview

This class is equality-comparable.

This class is equality-comparable with StatusCode.

Public Types

enum StatusCode { Ok, Cancelled, InvalidArgument, DeadlineExceeded, NotFound, …, Unauthenticated }

Properties

Public Functions

QGrpcStatus(QGrpcStatus::StatusCode code = Ok, QAnyStringView message = {})
QGrpcStatus(const QGrpcStatus &other)
QGrpcStatus(QGrpcStatus &&other)
~QGrpcStatus()
QGrpcStatus::StatusCode code() const
QString message() const
(since 6.8) void swap(QGrpcStatus &other)
(since 6.8) QVariant operator QVariant() const
QGrpcStatus &operator=(QGrpcStatus &&other)
QGrpcStatus &operator=(const QGrpcStatus &other)
(since 6.8) size_t qHash(const QGrpcStatus &key, size_t seed = 0)
bool operator!=(const QGrpcStatus &lhs, const QGrpcStatus &rhs)
bool operator!=(const QGrpcStatus &lhs, const QGrpcStatus::StatusCode &rhs)
(since 6.8) QDataStream &operator<<(QDataStream &out, const QGrpcStatus &status)
(since 6.8) QDebug operator<<(QDebug debug, const QGrpcStatus &status)
bool operator==(const QGrpcStatus &lhs, const QGrpcStatus &rhs)
bool operator==(const QGrpcStatus &lhs, const QGrpcStatus::StatusCode &rhs)
(since 6.8) QDataStream &operator>>(QDataStream &in, QGrpcStatus &status)

Detailed Description

The QGrpcStatus class contains information about the last gRPC operation returned from the respective channel, or other functions in the QtGrpc library.

If a RPC operation failed, contains a StatusCode other than Ok.

Member Type Documentation

enum QGrpcStatus::StatusCode

Channel's status codes.

ConstantValueDescription
QGrpcStatus::Ok0No error
QGrpcStatus::Cancelled1The operation was cancelled, typically by the caller.
QGrpcStatus::InvalidArgument3The client specified an invalid argument,
QGrpcStatus::DeadlineExceeded4The deadline expired before the operation could complete,
QGrpcStatus::NotFound5Some requested entity (e.g., file or directory) was not found.
QGrpcStatus::AlreadyExists6The entity that a client attempted to create (e.g., file or directory) already exists.
QGrpcStatus::PermissionDenied7The caller does not have permission to execute the specified operation. PermissionDenied must not be used for rejections caused by exhausting some resource (use ResourceExhausted instead for those errors). PermissionDenied must not be used if the caller can not be identified (use Unauthenticated instead for those errors). This error code does not imply the request is valid or the requested entity exists or satisfies other pre-conditions.
QGrpcStatus::ResourceExhausted8Some resource has been exhausted, perhaps a per-user quota, or perhaps the entire file system is out of space.
QGrpcStatus::FailedPrecondition9The operation was rejected because the system is not in a state required for the operation's execution.
QGrpcStatus::Aborted10The operation was aborted, typically due to a concurrency issue such as a sequencer check failure or transaction abort.
QGrpcStatus::OutOfRange11The operation was attempted past the valid range.
QGrpcStatus::Unimplemented12The operation is not implemented or is not supported/enabled in this service.
QGrpcStatus::Internal13This means that some invariants expected by the underlying system have been broken.
QGrpcStatus::Unavailable14The service is currently unavailable. This is most likely a transient condition, which can be corrected by retrying with a backoff. Note that it is not always safe to retry non-idempotent operations.
QGrpcStatus::DataLoss15Unrecoverable data loss or corruption.
QGrpcStatus::Unauthenticated16The request does not have valid authentication credentials for the operation.

See also gRPC status codes.

Property Documentation

[read-only] code : const StatusCode

QGrpcStatus::StatusCode received for prior gRPC call.

Access functions:

QGrpcStatus::StatusCode code() const

[read-only] message : const QString

Status message received for prior gRPC call.

Access functions:

QString message() const

Member Function Documentation

QGrpcStatus::QGrpcStatus(QGrpcStatus::StatusCode code = Ok, QAnyStringView message = {})

Constructs a QGrpcStatus with the status code code and the string message.

QGrpcStatus::QGrpcStatus(const QGrpcStatus &other)

Copy-constructs a QGrpcStatus from other

[noexcept] QGrpcStatus::QGrpcStatus(QGrpcStatus &&other)

Move-constructs a new QGrpcStatus from other.

Note: The moved-from object other is placed in a partially-formed state, in which the only valid operations are destruction and assignment of a new value.

[noexcept] QGrpcStatus::~QGrpcStatus()

Destroys the status object.

[noexcept] QGrpcStatus::StatusCode QGrpcStatus::code() const

Returns the contained StatusCode.

Note: Getter function for property code.

[noexcept] QString QGrpcStatus::message() const

Returns the contained status message.

Note: Getter function for property message.

[noexcept, since 6.8] void QGrpcStatus::swap(QGrpcStatus &other)

Swaps this instance with other. This operation is very fast and never fails.

This function was introduced in Qt 6.8.

[since 6.8] QVariant QGrpcStatus::operator QVariant() const

Constructs a new QVariant object from this QGrpcStatus.

This function was introduced in Qt 6.8.

[noexcept] QGrpcStatus &QGrpcStatus::operator=(QGrpcStatus &&other)

Move-assigns other to this QGrpcStatus instance and returns a reference to it.

Note: The moved-from object other is placed in a partially-formed state, in which the only valid operations are destruction and assignment of a new value.

QGrpcStatus &QGrpcStatus::operator=(const QGrpcStatus &other)

Assigns the data of the other object to this status object and returns a reference to it.

Related Non-Members

[noexcept, since 6.8] size_t qHash(const QGrpcStatus &key, size_t seed = 0)

Returns the hash value of key, using seed to seed the calculation.

This function was introduced in Qt 6.8.

[noexcept] bool operator!=(const QGrpcStatus &lhs, const QGrpcStatus &rhs)

Returns true if the status codes in lhs and rhs are not equal.

[noexcept] bool operator!=(const QGrpcStatus &lhs, const QGrpcStatus::StatusCode &rhs)

Returns true if the status codes in lhs and rhs are not equal.

[since 6.8] QDataStream &operator<<(QDataStream &out, const QGrpcStatus &status)

Writes the given status to the specified stream out.

This function was introduced in Qt 6.8.

[since 6.8] QDebug operator<<(QDebug debug, const QGrpcStatus &status)

Writes status to the specified stream debug.

This function was introduced in Qt 6.8.

[noexcept] bool operator==(const QGrpcStatus &lhs, const QGrpcStatus &rhs)

Returns true if the status codes in lhs and rhs are equal.

[noexcept] bool operator==(const QGrpcStatus &lhs, const QGrpcStatus::StatusCode &rhs)

Returns true if the status codes in lhs and rhs are equal.

[since 6.8] QDataStream &operator>>(QDataStream &in, QGrpcStatus &status)

Reads a QGrpcStatus from stream in into status.

This function was introduced in Qt 6.8.

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.