Commit 597fce8b authored by Vitaly Lipatov's avatar Vitaly Lipatov

UniSetTypes: add getArgInt

parent 231fac5e
......@@ -127,6 +127,20 @@ namespace UniSetTypes
class uniset_mutex;
class uniset_mutex_lock;
/// ( 0, 8-, 0x, 16-, . )
inline int uni_atoi( const char* str )
{
int n = 0; // if str is NULL or sscanf failed, we return 0
if ( str != NULL )
std::sscanf(str, "%i", &n);
return n;
}
inline int uni_atoi( const std::string str )
{
return uni_atoi(str.c_str());
}
typedef long KeyType; /*!< */
......@@ -157,6 +171,13 @@ namespace UniSetTypes
return defval;
}
inline int getArgInt( const std::string name,
int _argc, const char* const* _argv,
const std::string defval="" )
{
return uni_atoi(getArgParam(name, _argc, _argv, defval));
}
/*!
\param name -
\return -1, .
......@@ -205,19 +226,6 @@ namespace UniSetTypes
long setoutregion(long raw, long rawMin, long rawMax);
/// ( 0, 8-, 0x, 16-, . )
inline int uni_atoi( const char* str )
{
int n = 0; // if str is NULL or sscanf failed, we return 0
if ( str != NULL )
std::sscanf(str, "%i", &n);
return n;
}
inline int uni_atoi( const std::string str )
{
return uni_atoi(str.c_str());
}
bool file_exist( const std::string filename );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment