mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-29 14:45:55 +08:00
完善checkArgs函数
This commit is contained in:
parent
44ed51666f
commit
8311524935
@ -176,17 +176,17 @@ static inline void addHttpListener(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename Args,typename First>
|
template <typename Args,typename First>
|
||||||
bool checArgs(Args &&args,First &&first){
|
bool checkArgs(Args &&args,First &&first){
|
||||||
return !args[first].empty();
|
return !args[first].empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Args,typename First,typename ...KeyTypes>
|
template <typename Args,typename First,typename ...KeyTypes>
|
||||||
bool checArgs(Args &&args,First &&first,KeyTypes && ...keys){
|
bool checkArgs(Args &&args,First &&first,KeyTypes && ...keys){
|
||||||
return !args[first].empty() && checArgs(args,keys...);
|
return !args[first].empty() && checkArgs(std::forward<Args>(args),std::forward<KeyTypes>(keys)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CHECK_ARGS(...) \
|
#define CHECK_ARGS(...) \
|
||||||
if(!checArgs(allArgs,##__VA_ARGS__)){ \
|
if(!checkArgs(allArgs,##__VA_ARGS__)){ \
|
||||||
throw InvalidArgs("缺少必要参数:" #__VA_ARGS__); \
|
throw InvalidArgs("缺少必要参数:" #__VA_ARGS__); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user