Give better name to parameter checking function

This function will throw exceptions if the required parameters do not
exsit hence a stronger word is more appropriate here.

Also change the function parameter type to QVector. We don't need the
duplicate entries checking as currently we only use 3 fields at max and
can be easily checked by hand. So drop back to QVector which can be
constructed more efficiently.
This commit is contained in:
Chocobo1 2019-11-06 13:31:06 +08:00
parent 9cb07db84b
commit 9b5df92078
No known key found for this signature in database
GPG key ID: 210D9C873253A68C
7 changed files with 63 additions and 63 deletions

View file

@ -43,7 +43,7 @@ using Utils::String::parseBool;
void RSSController::addFolderAction()
{
checkParams({"path"});
requireParams({"path"});
const QString path = params()["path"].trimmed();
QString error;
@ -53,7 +53,7 @@ void RSSController::addFolderAction()
void RSSController::addFeedAction()
{
checkParams({"url", "path"});
requireParams({"url", "path"});
const QString url = params()["url"].trimmed();
const QString path = params()["path"].trimmed();
@ -64,7 +64,7 @@ void RSSController::addFeedAction()
void RSSController::removeItemAction()
{
checkParams({"path"});
requireParams({"path"});
const QString path = params()["path"].trimmed();
QString error;
@ -74,7 +74,7 @@ void RSSController::removeItemAction()
void RSSController::moveItemAction()
{
checkParams({"itemPath", "destPath"});
requireParams({"itemPath", "destPath"});
const QString itemPath = params()["itemPath"].trimmed();
const QString destPath = params()["destPath"].trimmed();
@ -93,7 +93,7 @@ void RSSController::itemsAction()
void RSSController::refreshItemAction()
{
checkParams({"itemPath"});
requireParams({"itemPath"});
const QString itemPath {params()["itemPath"]};
RSS::Item *item = RSS::Session::instance()->itemByPath(itemPath);
@ -103,7 +103,7 @@ void RSSController::refreshItemAction()
void RSSController::setRuleAction()
{
checkParams({"ruleName", "ruleDef"});
requireParams({"ruleName", "ruleDef"});
const QString ruleName {params()["ruleName"].trimmed()};
const QByteArray ruleDef {params()["ruleDef"].trimmed().toUtf8()};
@ -114,7 +114,7 @@ void RSSController::setRuleAction()
void RSSController::renameRuleAction()
{
checkParams({"ruleName", "newRuleName"});
requireParams({"ruleName", "newRuleName"});
const QString ruleName {params()["ruleName"].trimmed()};
const QString newRuleName {params()["newRuleName"].trimmed()};
@ -124,7 +124,7 @@ void RSSController::renameRuleAction()
void RSSController::removeRuleAction()
{
checkParams({"ruleName"});
requireParams({"ruleName"});
const QString ruleName {params()["ruleName"].trimmed()};
RSS::AutoDownloader::instance()->removeRule(ruleName);