Mark getters as const

This commit is contained in:
Shatur95 2021-01-25 00:16:37 +02:00 committed by Hennadii Chernyshchyk
parent e99b8df38f
commit 4aeac8fa3e
2 changed files with 20 additions and 20 deletions

View File

@ -172,9 +172,9 @@ SingleApplication::~SingleApplication()
* Checks if the current application instance is primary.
* @return Returns true if the instance is primary, false otherwise.
*/
bool SingleApplication::isPrimary()
bool SingleApplication::isPrimary() const
{
Q_D( SingleApplication );
Q_D( const SingleApplication );
return d->server != nullptr;
}
@ -182,9 +182,9 @@ bool SingleApplication::isPrimary()
* Checks if the current application instance is secondary.
* @return Returns true if the instance is secondary, false otherwise.
*/
bool SingleApplication::isSecondary()
bool SingleApplication::isSecondary() const
{
Q_D( SingleApplication );
Q_D( const SingleApplication );
return d->server == nullptr;
}
@ -194,9 +194,9 @@ bool SingleApplication::isSecondary()
* only incremented afterwards.
* @return Returns a unique instance id.
*/
quint32 SingleApplication::instanceId()
quint32 SingleApplication::instanceId() const
{
Q_D( SingleApplication );
Q_D( const SingleApplication );
return d->instanceNumber;
}
@ -206,9 +206,9 @@ quint32 SingleApplication::instanceId()
* specific APIs.
* @return Returns the primary instance PID.
*/
qint64 SingleApplication::primaryPid()
qint64 SingleApplication::primaryPid() const
{
Q_D( SingleApplication );
Q_D( const SingleApplication );
return d->primaryPid();
}
@ -216,9 +216,9 @@ qint64 SingleApplication::primaryPid()
* Returns the username the primary instance is running as.
* @return Returns the username the primary instance is running as.
*/
QString SingleApplication::primaryUser()
QString SingleApplication::primaryUser() const
{
Q_D( SingleApplication );
Q_D( const SingleApplication );
return d->primaryUser();
}
@ -226,7 +226,7 @@ QString SingleApplication::primaryUser()
* Returns the username the current instance is running as.
* @return Returns the username the current instance is running as.
*/
QString SingleApplication::currentUser()
QString SingleApplication::currentUser() const
{
return SingleApplicationPrivate::getUsername();
}
@ -267,8 +267,8 @@ void SingleApplication::abortSafely()
::exit( EXIT_FAILURE );
}
QStringList SingleApplication::userData()
QStringList SingleApplication::userData() const
{
Q_D( SingleApplication );
Q_D( const SingleApplication );
return d->appData();
}

View File

@ -92,37 +92,37 @@ public:
* @brief Returns if the instance is the primary instance
* @returns {bool}
*/
bool isPrimary();
bool isPrimary() const;
/**
* @brief Returns if the instance is a secondary instance
* @returns {bool}
*/
bool isSecondary();
bool isSecondary() const;
/**
* @brief Returns a unique identifier for the current instance
* @returns {qint32}
*/
quint32 instanceId();
quint32 instanceId() const;
/**
* @brief Returns the process ID (PID) of the primary instance
* @returns {qint64}
*/
qint64 primaryPid();
qint64 primaryPid() const;
/**
* @brief Returns the username of the user running the primary instance
* @returns {QString}
*/
QString primaryUser();
QString primaryUser() const;
/**
* @brief Returns the username of the current user
* @returns {QString}
*/
QString currentUser();
QString currentUser() const;
/**
* @brief Sends a message to the primary instance. Returns true on success.
@ -137,7 +137,7 @@ public:
* @brief Get the set user data.
* @returns {QStringList}
*/
QStringList userData();
QStringList userData() const;
Q_SIGNALS:
void instanceStarted();