From 46285e42fd17ddf6398908c163b5fb9b6da54827 Mon Sep 17 00:00:00 2001 From: Dario Manesku Date: Sun, 11 May 2014 18:03:14 +0100 Subject: [PATCH] Added commandline hasArg() float and double overloads. --- include/bx/commandline.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/include/bx/commandline.h b/include/bx/commandline.h index c5ca497..e184806 100644 --- a/include/bx/commandline.h +++ b/include/bx/commandline.h @@ -87,6 +87,31 @@ namespace bx return false; } + bool hasArg(float& _value, const char _short, const char* _long = NULL) const + { + const char* arg = findOption(_short, _long, 1); + if (NULL != arg) + { + _value = float(atof(arg)); + return true; + } + + return false; + } + + bool hasArg(double& _value, const char _short, const char* _long = NULL) const + { + const char* arg = findOption(_short, _long, 1); + if (NULL != arg) + { + _value = atof(arg); + return true; + } + + return false; + } + + bool hasArg(bool& _value, const char _short, const char* _long = NULL) const { const char* arg = findOption(_short, _long, 1);