Sfoglia il codice sorgente

Added commandline hasArg() float and double overloads.

Dario Manesku 11 anni fa
parent
commit
46285e42fd
1 ha cambiato i file con 25 aggiunte e 0 eliminazioni
  1. 25 0
      include/bx/commandline.h

+ 25 - 0
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);