Pass primitive types by value (#935)

This commit is contained in:
Murat Seker
2020-08-08 13:09:15 +02:00
committed by GitHub
parent 5758b19cbc
commit c00d8e62fb
146 changed files with 505 additions and 505 deletions

View File

@@ -46,14 +46,14 @@ public:
/// @param localConnection Is this a local network connection? Use utils/NetOrigin to check that
/// @param parent Parent QObject
///
API(Logger *log, const bool &localConnection, QObject *parent);
API(Logger *log, bool localConnection, QObject *parent);
protected:
///
/// @brief Initialize the API
/// This call is REQUIRED!
///
void init(void);
void init();
///
/// @brief Set a single color
@@ -62,7 +62,7 @@ protected:
/// @param[in] timeout_ms The time the leds are set to the given color [ms]
/// @param[in] origin The setter
///
void setColor(const int &priority, const std::vector<uint8_t> &ledColors, const int &timeout_ms = -1, const QString &origin = "API", const hyperion::Components &callerComp = hyperion::COMP_INVALID);
void setColor(int priority, const std::vector<uint8_t> &ledColors, int timeout_ms = -1, const QString &origin = "API", hyperion::Components callerComp = hyperion::COMP_INVALID);
///
/// @brief Set a image
@@ -72,7 +72,7 @@ protected:
/// @param callerComp The HYPERION COMPONENT that calls this function! e.g. PROT/FLATBUF
/// @return True on success
///
bool setImage(ImageCmdData &data, hyperion::Components comp, QString &replyMsg, const hyperion::Components &callerComp = hyperion::COMP_INVALID);
bool setImage(ImageCmdData &data, hyperion::Components comp, QString &replyMsg, hyperion::Components callerComp = hyperion::COMP_INVALID);
///
/// @brief Clear a priority in the Muxer, if -1 all priorities are cleared
@@ -81,7 +81,7 @@ protected:
/// @param callerComp The HYPERION COMPONENT that calls this function! e.g. PROT/FLATBUF
/// @return True on success
///
bool clearPriority(const int &priority, QString &replyMsg, const hyperion::Components &callerComp = hyperion::COMP_INVALID);
bool clearPriority(int priority, QString &replyMsg, hyperion::Components callerComp = hyperion::COMP_INVALID);
///
/// @brief Set a new component state
@@ -91,21 +91,21 @@ protected:
/// @param callerComp The HYPERION COMPONENT that calls this function! e.g. PROT/FLATBUF
/// @ return True on success
///
bool setComponentState(const QString &comp, bool &compState, QString &replyMsg, const hyperion::Components &callerComp = hyperion::COMP_INVALID);
bool setComponentState(const QString &comp, bool &compState, QString &replyMsg, hyperion::Components callerComp = hyperion::COMP_INVALID);
///
/// @brief Set a ledToImageMapping type
/// @param type mapping type string
/// @param callerComp The HYPERION COMPONENT that calls this function! e.g. PROT/FLATBUF
///
void setLedMappingType(const int &type, const hyperion::Components &callerComp = hyperion::COMP_INVALID);
void setLedMappingType(int type, hyperion::Components callerComp = hyperion::COMP_INVALID);
///
/// @brief Set the 2D/3D modes type
/// @param mode The VideoMode
/// @param callerComp The HYPERION COMPONENT that calls this function! e.g. PROT/FLATBUF
///
void setVideoMode(const VideoMode &mode, const hyperion::Components &callerComp = hyperion::COMP_INVALID);
void setVideoMode(VideoMode mode, hyperion::Components callerComp = hyperion::COMP_INVALID);
///
/// @brief Set an effect
@@ -113,21 +113,21 @@ protected:
/// @param callerComp The HYPERION COMPONENT that calls this function! e.g. PROT/FLATBUF
/// REQUIRED dat fields: effectName, priority, duration, origin
///
void setEffect(const EffectCmdData &dat, const hyperion::Components &callerComp = hyperion::COMP_INVALID);
void setEffect(const EffectCmdData &dat, hyperion::Components callerComp = hyperion::COMP_INVALID);
///
/// @brief Set source auto select enabled or disabled
/// @param sate The new state
/// @param callerComp The HYPERION COMPONENT that calls this function! e.g. PROT/FLATBUF
///
void setSourceAutoSelect(const bool state, const hyperion::Components &callerComp = hyperion::COMP_INVALID);
void setSourceAutoSelect(bool state, hyperion::Components callerComp = hyperion::COMP_INVALID);
///
/// @brief Set the visible priority to given priority
/// @param priority The priority to set
/// @param callerComp The HYPERION COMPONENT that calls this function! e.g. PROT/FLATBUF
///
void setVisiblePriority(const int &priority, const hyperion::Components &callerComp = hyperion::COMP_INVALID);
void setVisiblePriority(int priority, hyperion::Components callerComp = hyperion::COMP_INVALID);
///
/// @brief Register a input or update the meta data of a previous register call
@@ -138,21 +138,21 @@ protected:
/// @param[in] owner Specific owner string, might be empty
/// @param[in] callerComp The component that call this (e.g. PROTO/FLAT)
///
void registerInput(const int &priority, const hyperion::Components &component, const QString &origin, const QString &owner, const hyperion::Components &callerComp);
void registerInput(int priority, hyperion::Components component, const QString &origin, const QString &owner, hyperion::Components callerComp);
///
/// @brief Revoke a registerInput() call by priority. We maintain all registered priorities in this scope
/// ATTENTION: This is MANDATORY if you change (priority change) or stop(clear/timeout) DURING lifetime. If this class destructs it's not needed
/// @param priority The priority to unregister
///
void unregisterInput(const int &priority);
void unregisterInput(int priority);
///
/// @brief Handle the instance switching
/// @param inst The requested instance
/// @return True on success else false
///
bool setHyperionInstance(const quint8 &inst);
bool setHyperionInstance(quint8 inst);
///
/// @brief Get all contrable components and their state
@@ -169,19 +169,19 @@ protected:
/// @brief Get all instances data
/// @return The instance data
///
QVector<QVariantMap> getAllInstanceData(void);
QVector<QVariantMap> getAllInstanceData();
///
/// @brief Start instance
/// @param index The instance index
///
void startInstance(const quint8 &index);
void startInstance(quint8 index);
///
/// @brief Stop instance
/// @param index The instance index
///
void stopInstance(const quint8 &index);
void stopInstance(quint8 index);
//////////////////////////////////
/// AUTH / ADMINISTRATION METHODS
@@ -193,7 +193,7 @@ protected:
/// @param replyMsg The reply Msg
/// @return False with reply
///
bool deleteInstance(const quint8 &index, QString &replyMsg);
bool deleteInstance(quint8 index, QString &replyMsg);
///
/// @brief Create instance. Requires ADMIN ACCESS
@@ -208,7 +208,7 @@ protected:
/// @param name With given name
/// @return False with reply
///
QString setInstanceName(const quint8 &index, const QString &name);
QString setInstanceName(quint8 index, const QString &name);
///
/// @brief Delete an effect. Requires ADMIN ACCESS
@@ -292,7 +292,7 @@ protected:
/// @param id The id fo the request
/// @param accept True when it should be accepted, else false
/// @return True on success
bool handlePendingTokenRequest(const QString &id, const bool accept);
bool handlePendingTokenRequest(const QString &id, bool accept);
///
/// @brief Get the current List of Tokens. Requires ADMIN ACCESS
@@ -379,7 +379,7 @@ signals:
/// @param comment The comment that was part of the request
/// @param id The id that was part of the request
///
void onTokenResponse(const bool &success, const QString &token, const QString &comment, const QString &id);
void onTokenResponse(bool success, const QString &token, const QString &comment, const QString &id);
private slots:
///
@@ -396,7 +396,7 @@ private slots:
/// @param comment The comment that was part of the request
/// @param id The id that was part of the request
///
void checkTokenResponse(const bool &success, QObject *caller, const QString &token, const QString &comment, const QString &id);
void checkTokenResponse(bool success, QObject *caller, const QString &token, const QString &comment, const QString &id);
private:
void stopDataConnectionss();

View File

@@ -30,7 +30,7 @@ public:
/// @param localConnection True when the sender has origin home network
/// @param noListener if true, this instance won't listen for hyperion push events
///
JsonAPI(QString peerAddress, Logger *log, const bool &localConnection, QObject *parent, bool noListener = false);
JsonAPI(QString peerAddress, Logger *log, bool localConnection, QObject *parent, bool noListener = false);
///
/// Handle an incoming JSON message
@@ -42,7 +42,7 @@ public:
///
/// @brief Initialization steps
///
void initialize(void);
void initialize();
public slots:
///
@@ -77,7 +77,7 @@ private slots:
/// @param comment The comment that was part of the request
/// @param id The id that was part of the request
///
void handleTokenResponse(const bool &success, const QString &token, const QString &comment, const QString &id);
void handleTokenResponse(bool success, const QString &token, const QString &comment, const QString &id);
///
/// @brief Handle whenever the state of a instance (HyperionIManager) changes according to enum instanceState
@@ -85,7 +85,7 @@ private slots:
/// @param instance The index of instance
/// @param name The name of the instance, just available with H_CREATED
///
void handleInstanceStateChange(const InstanceState &state, const quint8 &instance, const QString &name = QString());
void handleInstanceStateChange(InstanceState state, quint8 instance, const QString &name = QString());
signals:
///
@@ -131,151 +131,151 @@ private:
/// @param forced indicate if it was a forced switch by system
/// @return true on success. false if not found
///
bool handleInstanceSwitch(const quint8 &instance = 0, const bool &forced = false);
bool handleInstanceSwitch(quint8 instance = 0, bool forced = false);
///
/// Handle an incoming JSON Color message
///
/// @param message the incoming message
///
void handleColorCommand(const QJsonObject &message, const QString &command, const int tan);
void handleColorCommand(const QJsonObject &message, const QString &command, int tan);
///
/// Handle an incoming JSON Image message
///
/// @param message the incoming message
///
void handleImageCommand(const QJsonObject &message, const QString &command, const int tan);
void handleImageCommand(const QJsonObject &message, const QString &command, int tan);
///
/// Handle an incoming JSON Effect message
///
/// @param message the incoming message
///
void handleEffectCommand(const QJsonObject &message, const QString &command, const int tan);
void handleEffectCommand(const QJsonObject &message, const QString &command, int tan);
///
/// Handle an incoming JSON Effect message (Write JSON Effect)
///
/// @param message the incoming message
///
void handleCreateEffectCommand(const QJsonObject &message, const QString &command, const int tan);
void handleCreateEffectCommand(const QJsonObject &message, const QString &command, int tan);
///
/// Handle an incoming JSON Effect message (Delete JSON Effect)
///
/// @param message the incoming message
///
void handleDeleteEffectCommand(const QJsonObject &message, const QString &command, const int tan);
void handleDeleteEffectCommand(const QJsonObject &message, const QString &command, int tan);
///
/// Handle an incoming JSON System info message
///
/// @param message the incoming message
///
void handleSysInfoCommand(const QJsonObject &message, const QString &command, const int tan);
void handleSysInfoCommand(const QJsonObject &message, const QString &command, int tan);
///
/// Handle an incoming JSON Server info message
///
/// @param message the incoming message
///
void handleServerInfoCommand(const QJsonObject &message, const QString &command, const int tan);
void handleServerInfoCommand(const QJsonObject &message, const QString &command, int tan);
///
/// Handle an incoming JSON Clear message
///
/// @param message the incoming message
///
void handleClearCommand(const QJsonObject &message, const QString &command, const int tan);
void handleClearCommand(const QJsonObject &message, const QString &command, int tan);
///
/// Handle an incoming JSON Clearall message
///
/// @param message the incoming message
///
void handleClearallCommand(const QJsonObject &message, const QString &command, const int tan);
void handleClearallCommand(const QJsonObject &message, const QString &command, int tan);
///
/// Handle an incoming JSON Adjustment message
///
/// @param message the incoming message
///
void handleAdjustmentCommand(const QJsonObject &message, const QString &command, const int tan);
void handleAdjustmentCommand(const QJsonObject &message, const QString &command, int tan);
///
/// Handle an incoming JSON SourceSelect message
///
/// @param message the incoming message
///
void handleSourceSelectCommand(const QJsonObject &message, const QString &command, const int tan);
void handleSourceSelectCommand(const QJsonObject &message, const QString &command, int tan);
/// Handle an incoming JSON GetConfig message and check subcommand
///
/// @param message the incoming message
///
void handleConfigCommand(const QJsonObject &message, const QString &command, const int tan);
void handleConfigCommand(const QJsonObject &message, const QString &command, int tan);
/// Handle an incoming JSON GetSchema message from handleConfigCommand()
///
/// @param message the incoming message
///
void handleSchemaGetCommand(const QJsonObject &message, const QString &command, const int tan);
void handleSchemaGetCommand(const QJsonObject &message, const QString &command, int tan);
/// Handle an incoming JSON SetConfig message from handleConfigCommand()
///
/// @param message the incoming message
///
void handleConfigSetCommand(const QJsonObject &message, const QString &command, const int tan);
void handleConfigSetCommand(const QJsonObject &message, const QString &command, int tan);
///
/// Handle an incoming JSON Component State message
///
/// @param message the incoming message
///
void handleComponentStateCommand(const QJsonObject &message, const QString &command, const int tan);
void handleComponentStateCommand(const QJsonObject &message, const QString &command, int tan);
/// Handle an incoming JSON Led Colors message
///
/// @param message the incoming message
///
void handleLedColorsCommand(const QJsonObject &message, const QString &command, const int tan);
void handleLedColorsCommand(const QJsonObject &message, const QString &command, int tan);
/// Handle an incoming JSON Logging message
///
/// @param message the incoming message
///
void handleLoggingCommand(const QJsonObject &message, const QString &command, const int tan);
void handleLoggingCommand(const QJsonObject &message, const QString &command, int tan);
/// Handle an incoming JSON Processing message
///
/// @param message the incoming message
///
void handleProcessingCommand(const QJsonObject &message, const QString &command, const int tan);
void handleProcessingCommand(const QJsonObject &message, const QString &command, int tan);
/// Handle an incoming JSON VideoMode message
///
/// @param message the incoming message
///
void handleVideoModeCommand(const QJsonObject &message, const QString &command, const int tan);
void handleVideoModeCommand(const QJsonObject &message, const QString &command, int tan);
/// Handle an incoming JSON plugin message
///
/// @param message the incoming message
///
void handleAuthorizeCommand(const QJsonObject &message, const QString &command, const int tan);
void handleAuthorizeCommand(const QJsonObject &message, const QString &command, int tan);
/// Handle an incoming JSON instance message
///
/// @param message the incoming message
///
void handleInstanceCommand(const QJsonObject &message, const QString &command, const int tan);
void handleInstanceCommand(const QJsonObject &message, const QString &command, int tan);
/// Handle an incoming JSON Led Device message
///
/// @param message the incoming message
///
void handleLedDeviceCommand(const QJsonObject &message, const QString &command, const int tan);
void handleLedDeviceCommand(const QJsonObject &message, const QString &command, int tan);
///
/// Handle an incoming JSON message of unknown type
@@ -285,22 +285,22 @@ private:
///
/// Send a standard reply indicating success
///
void sendSuccessReply(const QString &command = "", const int tan = 0);
void sendSuccessReply(const QString &command = "", int tan = 0);
///
/// Send a standard reply indicating success with data
///
void sendSuccessDataReply(const QJsonDocument &doc, const QString &command = "", const int &tan = 0);
void sendSuccessDataReply(const QJsonDocument &doc, const QString &command = "", int tan = 0);
///
/// Send an error message back to the client
///
/// @param error String describing the error
///
void sendErrorReply(const QString &error, const QString &command = "", const int tan = 0);
void sendErrorReply(const QString &error, const QString &command = "", int tan = 0);
///
/// @brief Kill all signal/slot connections to stop possible data emitter
///
void stopDataConnections(void);
void stopDataConnections();
};

View File

@@ -35,7 +35,7 @@ public:
/// @param unsubscribe Revert subscription
/// @return True on success, false if not found
///
bool subscribeFor(const QString& cmd, const bool & unsubscribe = false);
bool subscribeFor(const QString& cmd, bool unsubscribe = false);
///
/// @brief Get all possible commands to subscribe for
@@ -52,7 +52,7 @@ public:
///
/// @brief Reset subscriptions, disconnect all signals
///
void resetSubscriptions(void);
void resetSubscriptions();
///
/// @brief Re-apply all current subs to a new Hyperion instance, the connections to the old instance will be dropped
@@ -70,7 +70,7 @@ private slots:
///
/// @brief handle component state changes
///
void handleComponentState(const hyperion::Components comp, const bool state);
void handleComponentState(hyperion::Components comp, bool state);
#ifdef ENABLE_AVAHI
///
/// @brief handle emits from bonjour wrapper
@@ -86,7 +86,7 @@ private slots:
///
/// @brief Handle imageToLedsMapping updates
///
void handleImageToLedsMappingChange(const int& mappingType);
void handleImageToLedsMappingChange(int mappingType);
///
/// @brief Handle the adjustment update
@@ -97,7 +97,7 @@ private slots:
/// @brief Handle video mode change
/// @param mode The new videoMode
///
void handleVideoModeChange(const VideoMode& mode);
void handleVideoModeChange(VideoMode mode);
///
/// @brief Handle effect list change
@@ -109,14 +109,14 @@ private slots:
/// @param type The settings type from enum
/// @param data The data as QJsonDocument
///
void handleSettingsChange(const settings::type& type, const QJsonDocument& data);
void handleSettingsChange(settings::type type, const QJsonDocument& data);
///
/// @brief Handle led config specific updates (required for led color streaming with positional display)
/// @param type The settings type from enum
/// @param data The data as QJsonDocument
///
void handleLedsConfigChange(const settings::type& type, const QJsonDocument& data);
void handleLedsConfigChange(settings::type type, const QJsonDocument& data);
///
/// @brief Handle Hyperion instance manager change