-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclioption.cc
49 lines (40 loc) · 1 KB
/
clioption.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*!
* \file
* C++ implementation for the \c CliOption class.
*
* \author Stephen Bryant <[email protected]>
* \date $Date: 2010-09-23 17:59:55 +0200 (Thu, 23 Sep 2010) $
*/
#include "clioption.h"
#include <QLatin1Char>
CliOption::CliOption()
: m_bHasArg( false )
{
}
CliOption::CliOption( const QStringList & names, const bool bHasArg )
: m_bHasArg( bHasArg )
{
setNames( names );
}
void CliOption::setNames( const QStringList & names )
{
QStringList::const_iterator iter;
static const QLatin1Char dashChar( '-' );
for ( iter = names.constBegin();
iter != names.constEnd();
iter ++ )
{
if ( ! (*iter).isEmpty() &&
( (*iter).at( 0 ) != dashChar ) )
{
if ( (*iter).size() == 1 )
{
m_shortnameSet.insert( (*iter).at( 0 ) );
}
else
{
m_longnameSet.insert( *iter );
}
}
} // for loop through names
} // CliOption::setNames()