Cute   Learning Hub

Cute Namespace

Header: #include <CuteClient.h> #include <CuteServer.h>


namespace Client
namespace Server


class ConnectionInfo
class DataStream
union Error
struct ErrorInfo
class IConnectionInformation
class IErrorHandler


enum class ConnectionError { InvalidProxyHeader, ProxyHeaderReadTimedOut, SslHandshakeTimedOut, WebSocketHandshakeTimedOut, CuteHandshakeTimedOut, …, NotRegisteredArgument }
enum class ErrorType { Socket, SSL, Connection }


int registerType()
void setErrorHandler(Cute::IErrorHandler *errorHandlerInstance)

Detailed Description

Common classes used by both client and server SDKs.


namespace Cute::Client

Classes used by client SDK.

namespace Cute::Server

Classes used by server SDK.


class ConnectionInfo

The Cute::ConnectionInfo holds connection information when handling errors. More...

class DataStream

The Cute::DataStream allows custom types to be streamed in remote signal slot connections as well as direct remote slot calls. More...

class Error

class ErrorInfo

Cute::ErrorInfo holds information about the error that happened in the connection. More...

class IConnectionInformation

The Cute::IConnectionInformation class is an interface allowing interaction with the established connection. More...

class IErrorHandler

The Cute::IErrorHandler is an interface that error handlers must implement. More...

Type Documentation

enum class Cute::ConnectionError

This enum type specifies the type of the error that happened in the connection:

Cute::ConnectionError::InvalidProxyHeader0Invalid proxy header.
Cute::ConnectionError::ProxyHeaderReadTimedOut1Proxy header read timed out.
Cute::ConnectionError::SslHandshakeTimedOut2SSL handshake timed out.
Cute::ConnectionError::WebSocketHandshakeTimedOut3WebSocket handshake timed out.
Cute::ConnectionError::CuteHandshakeTimedOut4Cute handshake timed out.
Cute::ConnectionError::CuteHandshakeFailed5Cute handshake failed.
Cute::ConnectionError::RequestTimedOut6Request timed out.
Cute::ConnectionError::ConnectionTimedOut7Connection timed out.
Cute::ConnectionError::MessageIntegrityCheckFailed8Message integrity check failed.
Cute::ConnectionError::InvalidHttpRequest9Invalid http request.
Cute::ConnectionError::HttpHandlerNotFound10Http handler was not found
Cute::ConnectionError::InvalidMessage11Invalid message.
Cute::ConnectionError::RemoteObjectNotFound12Remote object not found.
Cute::ConnectionError::RemoteSignalNotFound13Remote signal not found.
Cute::ConnectionError::RemoteSlotNotFound14Remote slot not found.
Cute::ConnectionError::TooBigSignal15Signal is too big (has more than 10 arguments).
Cute::ConnectionError::InvalidObject16Invalid object.
Cute::ConnectionError::InvalidSignal17Invalid signal.
Cute::ConnectionError::InvalidSlot18Invalid slot.
Cute::ConnectionError::IncompatibleSignalSlot19Signal is incompatible to slot.
Cute::ConnectionError::InvalidSignalEmitter20Signal emitter is invalid.
Cute::ConnectionError::RemoteSlotRaisedException21Remote slot raised an exception.
Cute::ConnectionError::TooManyRemoteObjectsPerConnection22Too many remote objects per connection.
Cute::ConnectionError::TooManyRemoteSignalSlotConnections23Too many remote signal slot connections.
Cute::ConnectionError::InvalidRemoteObjectUrl24Remote object url is not valid.
Cute::ConnectionError::ConnectionDropped25Connection dropped.
Cute::ConnectionError::ConnectedReceiverNotFound26Connected receiver not found.
Cute::ConnectionError::InvalidArgType27Argument is invalid. It is a pointer or reference to a pointer (**, *&, *).
Cute::ConnectionError::NotRegisteredArgument28Argument is not registered. Use Cute::registerType to register a custom type.

enum class Cute::ErrorType

This enum type specifies the type of the error that happened in the connection:

Cute::ErrorType::Socket0Error happened in socket (QAbstractSocket::SocketError).
Cute::ErrorType::SSL1Error happened in SSL handshake (QSslError::SslError).
Cute::ErrorType::Connection2Cute connection error (Cute::ConnectionError).

Function Documentation

template <typename T> int Cute::registerType()

This function registers the type T to Cute so that it can be used on remote signals and slots. T must be fully defined and T must be declared with Q_DECLARE_METATYPE(). Returns the meta type Id.

void Cute::setErrorHandler(Cute::IErrorHandler *errorHandlerInstance)

Sets errorHandlerInstance as the instance responsible for receiving errors. Although errors may originate from different threads, Cute Server serializes error reporting to this instance. Thus, implementors do not have to worry about making handler thread-safe. Any previously set handler is destroyed. This function is thread-safe.

Note that remote objects are compiled into a shared library that is loaded by server during runtime. Thus, to set the error handler, setErrorHandler can be called in a function tagged with the constructor attribute. Both GCC and Clang support attributes. setErrorHandler can be called during library loading as shown below:

// function to run when library loads
static void initialize_remote_objects_lib()
    // MyErrorHandler is a class that inherits IErrorHandler
    Cute::setErrorHandler(new MyErrorHandler);