Const correctness, override keyword, a bunch of stuff..

This commit is contained in:
Murat
2020-08-08 23:12:43 +02:00
parent 4099d12d9a
commit 4a688b932a
144 changed files with 622 additions and 566 deletions

View File

@@ -10,13 +10,13 @@
namespace FileUtils {
QString getBaseName(QString sourceFile)
QString getBaseName(const QString& sourceFile)
{
QFileInfo fi(sourceFile);
return fi.fileName();
}
QString getDirName(QString sourceFile)
QString getDirName(const QString& sourceFile)
{
QFileInfo fi(sourceFile);
return fi.path();

View File

@@ -114,7 +114,7 @@ Logger::LogLevel Logger::getLogLevel(const QString & name)
return static_cast<Logger::LogLevel>(int(GLOBAL_MIN_LOG_LEVEL));
}
Logger* log = Logger::getInstance(name);
const Logger* log = Logger::getInstance(name);
return log->getMinLevel();
}

View File

@@ -13,7 +13,7 @@ NetOrigin::NetOrigin(QObject* parent, Logger* log)
NetOrigin::instance = this;
}
bool NetOrigin::accessAllowed(const QHostAddress& address, const QHostAddress& local)
bool NetOrigin::accessAllowed(const QHostAddress& address, const QHostAddress& local) const
{
if(_internetAccessAllowed)
return true;
@@ -29,7 +29,7 @@ bool NetOrigin::accessAllowed(const QHostAddress& address, const QHostAddress& l
return true;
}
bool NetOrigin::isLocalAddress(const QHostAddress& address, const QHostAddress& local)
bool NetOrigin::isLocalAddress(const QHostAddress& address, const QHostAddress& local) const
{
if(address.protocol() == QAbstractSocket::IPv4Protocol)
{

View File

@@ -6,7 +6,7 @@ namespace Process {
void restartHyperion(bool asNewProcess){}
QByteArray command_exec(QString /*cmd*/, QByteArray /*data*/)
QByteArray command_exec(const QString& /*cmd*/, const QByteArray& /*data*/)
{
return QSTRING_CSTR(QString());
}
@@ -48,7 +48,7 @@ void restartHyperion(bool asNewProcess)
QCoreApplication::quit();
}
QByteArray command_exec(QString cmd, QByteArray data)
QByteArray command_exec(const QString& cmd, const QByteArray& data)
{
char buffer[128];
QString result;

View File

@@ -43,7 +43,7 @@ void Profiler::initLogger()
_logger = Logger::getInstance("PROFILER", Logger::DEBUG);
}
void Profiler::TimerStart(const QString timerName, const char* sourceFile, const char* func, unsigned int line)
void Profiler::TimerStart(const QString& timerName, const char* sourceFile, const char* func, unsigned int line)
{
std::pair<std::map<QString,StopWatchItem>::iterator,bool> ret;
Profiler::initLogger();
@@ -71,7 +71,7 @@ void Profiler::TimerStart(const QString timerName, const char* sourceFile, const
}
void Profiler::TimerGetTime(const QString timerName, const char* sourceFile, const char* func, unsigned int line)
void Profiler::TimerGetTime(const QString& timerName, const char* sourceFile, const char* func, unsigned int line)
{
std::map<QString,StopWatchItem>::iterator ret = GlobalProfilerMap.find(timerName);
Profiler::initLogger();

View File

@@ -5,7 +5,7 @@
namespace RGBW {
WhiteAlgorithm stringToWhiteAlgorithm(QString str)
WhiteAlgorithm stringToWhiteAlgorithm(const QString& str)
{
if (str == "subtract_minimum") return WhiteAlgorithm::SUBTRACT_MINIMUM;
if (str == "sub_min_warm_adjust") return WhiteAlgorithm::SUB_MIN_WARM_ADJUST;

View File

@@ -166,7 +166,7 @@ void QJsonSchemaChecker::setMessage(const QString & message)
_messages.append(_currentPath.join("") +": "+message);
}
const QStringList & QJsonSchemaChecker::getMessages() const
QStringList QJsonSchemaChecker::getMessages() const
{
return _messages;
}