QGrpcStatus Class | Qt GRPC | Qt 6.10.3
Description: The QGrpcStatus class combines a StatusCode and a string message.

- Qt 6.10
- Qt GRPC
- C++ Classes
- QGrpcStatus
- Qt 6.10.3 Reference Documentation

# QGrpcStatus Class

The QGrpcStatus 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

- List of all members, including inherited members

This class is equality-comparable.

This class is equality-comparable with QtGrpc::StatusCode.

## Properties

- code : const QtGrpc::StatusCode
- message : const QString

## Public Functions

| QGrpcStatus(QtGrpc::StatusCode code = {}, QAnyStringView message = {})
| QGrpcStatus(const QGrpcStatus &other)
| QGrpcStatus(QGrpcStatus &&other)
| ~QGrpcStatus()
QtGrpc::StatusCode | code() const
`(since 6.8)` bool | isOk() const
QString | message() &&
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)

## Related Non-Members

`(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 QtGrpc::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 QtGrpc::StatusCode &rhs)
`(since 6.8)` QDataStream & | operator>>(QDataStream &in, QGrpcStatus &status)

## Detailed Description

The QGrpcStatus class usually provides information about a finished gRPC™ operation, as returned by the server.

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

## Property Documentation

### `[read-only]` code : const QtGrpc::StatusCode

StatusCode received for prior gRPC call.

Access functions:

QtGrpc::StatusCode | code() const

### `[read-only]` message : const QString

Status message received for prior gRPC call.

Access functions:

const QString & | message() const &
QString | message() &&

## Member Function Documentation

### QGrpcStatus::QGrpcStatus(QtGrpc::StatusCode code = {}, 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 QGrpcStatus.

### `[noexcept]` QtGrpc::StatusCode QGrpcStatus::code() const

Returns the contained StatusCode.

Note: Getter function for property code.

### `[noexcept, since 6.8]` bool QGrpcStatus::isOk() const

Returns `true` if code() is equal to Ok.

This function was introduced in Qt 6.8.

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

Swaps other with this object. 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 from this object.

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 QtGrpc::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 QtGrpc::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.