This commit is contained in:
parent
637e7c5a23
commit
d0fa2671fa
|
@ -1,4 +1,5 @@
|
|||
#include "argsparser.h"
|
||||
#include <QVariant>
|
||||
|
||||
using namespace args_parse;
|
||||
using namespace std;
|
||||
|
@ -14,11 +15,11 @@ QString __ArgvPackImpls::means() const {
|
|||
return means_store;
|
||||
}
|
||||
|
||||
void __ArgvPackImpls::setValue(const QString& v) {
|
||||
void __ArgvPackImpls::setValue(const QVariant& v) {
|
||||
this->value_store = v;
|
||||
}
|
||||
|
||||
QString __ArgvPackImpls::value() const {
|
||||
QVariant __ArgvPackImpls::value() const {
|
||||
return value_store;
|
||||
}
|
||||
|
||||
|
@ -74,7 +75,6 @@ __FloatArgvImpls::__FloatArgvImpls(const QString& key, const QString& means, boo
|
|||
|
||||
FloatOption::FloatOption(const QString& key, const QString& means, bool opt)
|
||||
: __FloatArgvImpls(key, means, opt) {
|
||||
setValue(u8"0");
|
||||
}
|
||||
|
||||
QString args_parse::FloatOption::placeHolder() const {
|
||||
|
@ -89,7 +89,7 @@ int FloatOption::matchLenth() const {
|
|||
|
||||
bool FloatOption::parse(const QList<QString> args, int start) {
|
||||
auto args_t = args[start];
|
||||
setValue(QString::number(args_t == bindKey()));
|
||||
setValue(args_t == bindKey());
|
||||
return args_t == u8"--" + bindKey();
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <QList>
|
||||
#include <qHash>
|
||||
#include <tuple>
|
||||
#include <QVariant>
|
||||
#include "argsparser_global.h"
|
||||
|
||||
namespace args_parse {
|
||||
|
@ -35,7 +36,7 @@ namespace args_parse {
|
|||
*/
|
||||
virtual QString means() const = 0;
|
||||
virtual QString placeHolder() const = 0;
|
||||
virtual QString value() const = 0;
|
||||
virtual QVariant value() const = 0;
|
||||
/**
|
||||
* @brief Æ¥Å䳤¶È.
|
||||
*
|
||||
|
@ -55,18 +56,18 @@ namespace args_parse {
|
|||
class ARGSPARSER_EXPORT __ArgvPackImpls : public IArgvPack {
|
||||
private:
|
||||
QString means_store;
|
||||
QString value_store;
|
||||
QVariant value_store;
|
||||
ParamType type_store;
|
||||
|
||||
public:
|
||||
__ArgvPackImpls(const QString &means, ParamType t);
|
||||
|
||||
void setValue(const QString &v);
|
||||
void setValue(const QVariant &v);
|
||||
|
||||
// ͨ¹ý IArgvPack ¼Ì³Ð
|
||||
ParamType paramType() const override;
|
||||
QString means() const override;
|
||||
QString value() const override;
|
||||
QVariant value() const override;
|
||||
};
|
||||
|
||||
class ARGSPARSER_EXPORT __FloatArgvImpls : public __ArgvPackImpls {
|
||||
|
|
|
@ -60,15 +60,15 @@ int main(int argc, char* argv[]) {
|
|||
auto dst_dir = dynamic_pointer_cast<FloatKeyValue>(p_result->getUnitViaKey(u8"dest"));
|
||||
auto html_opt = dynamic_pointer_cast<FloatOption>(p_result->getUnitViaKey(u8"html"));
|
||||
|
||||
auto source_dir = QDir(src_dir->value());
|
||||
auto source_dir = QDir(src_dir->value().toString());
|
||||
if (!source_dir.exists()) {
|
||||
cout << "%编译指定的源代码目录不存在!" << endl;
|
||||
exit(0);
|
||||
}
|
||||
auto destination_dir = QDir::current();
|
||||
auto target_output = dst_dir->value();
|
||||
if (!target_output.isEmpty() && QDir(target_output).exists()) {
|
||||
destination_dir = QDir(target_output);
|
||||
if (!target_output.isNull() && QDir(target_output.toString()).exists()) {
|
||||
destination_dir = QDir(target_output.toString());
|
||||
}
|
||||
else {
|
||||
cout << "%编译指定的生成目录不存在,重置为:" << destination_dir.absolutePath().toLocal8Bit().data() << endl;
|
||||
|
|
Loading…
Reference in New Issue