mirror of
https://github.com/chenx-dust/EZ4Connect.git
synced 2026-09-20 10:23:33 +08:00
refactor: 大规模架构重构
This commit is contained in:
19
application/commandlineoptions.cpp
Normal file
19
application/commandlineoptions.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
#include "commandlineoptions.h"
|
||||
|
||||
QString CommandLineOptions::value(const QStringList &arguments, const QString &key)
|
||||
{
|
||||
const QString prefix = key + "=";
|
||||
for (int index = 0; index < arguments.size(); ++index)
|
||||
{
|
||||
const QString &argument = arguments.at(index);
|
||||
if (argument == key)
|
||||
{
|
||||
return index + 1 < arguments.size() ? arguments.at(index + 1) : QString();
|
||||
}
|
||||
if (argument.startsWith(prefix))
|
||||
{
|
||||
return argument.mid(prefix.size());
|
||||
}
|
||||
}
|
||||
return {};
|
||||
}
|
||||
Reference in New Issue
Block a user