update cmakelist
This commit is contained in:
parent
bcdd3b1922
commit
5e28c17115
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Mac",
|
||||
"defines": [],
|
||||
"compilerPath": "/usr/bin/clang",
|
||||
"cStandard": "c17",
|
||||
"cppStandard": "c++17",
|
||||
"intelliSenseMode": "macos-clang-x64",
|
||||
"includePath": [
|
||||
"/"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "mloc",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/**"
|
||||
],
|
||||
"defines": [],
|
||||
"compilerPath": "/usr/bin/clang",
|
||||
"cStandard": "c17",
|
||||
"cppStandard": "c++17",
|
||||
"intelliSenseMode": "macos-clang-x64"
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
project(ArgsParser CXX)
|
||||
|
||||
set(CMAKE_PREFIX_PATH "~/Qt5.12.4/5.12.4/clang_64/lib/cmake")
|
||||
|
||||
find_package(Qt5 COMPONENTS Core REQUIRED)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
add_library(ArgsParser argsparser.cpp)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
|
||||
target_link_libraries(ArgsParser Qt5::Core)
|
|
@ -107,10 +107,18 @@ bool FloatOption::parse(const QList<QString> args) {
|
|||
MatchMode::MatchMode(int mode_code, const QString& mode)
|
||||
:_means_explain(mode), code_store(mode_code) { }
|
||||
|
||||
/**
|
||||
* @brief 获取模式代码
|
||||
* @return 模式代码
|
||||
*/
|
||||
#include <QtCore/QByteArray>
|
||||
class inner_exception : public std::exception {
|
||||
private:
|
||||
QByteArray _message;
|
||||
|
||||
public:
|
||||
inner_exception(const QString &msg)
|
||||
:_message(msg.toUtf8()){}
|
||||
virtual const char* what() const noexcept{
|
||||
return _message.data();
|
||||
}
|
||||
};
|
||||
|
||||
MatchMode& MatchMode::operator<<(std::shared_ptr<IArgvPack> unit) {
|
||||
if(unit->paramType() == ParamType::FloatParam){
|
||||
|
@ -119,7 +127,7 @@ MatchMode& MatchMode::operator<<(std::shared_ptr<IArgvPack> unit) {
|
|||
if (u_exist->paramType() == ParamType::FloatParam) {
|
||||
auto u_cast = std::dynamic_pointer_cast<__FloatArgvImpls>(u_exist);
|
||||
if (u_cast->bindKey() == unit_in->bindKey())
|
||||
throw new std::exception("重复设置选项");
|
||||
throw new inner_exception("重复设置选项");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue