-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCmdLineParser.cpp
More file actions
executable file
·36 lines (34 loc) · 924 Bytes
/
CmdLineParser.cpp
File metadata and controls
executable file
·36 lines (34 loc) · 924 Bytes
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
//
// CmdLineParser.cpp
// CmdLineParser
//
// Created by Swasti Gupta on 5/31/15.
//
//
#include "CmdLineParser.h"
/*
Param starting index of command line
Param end index of command line
Param command line parameter
Description returns the value followed by specified
command line parameter otherwise NULL
*/
char* CmdLineParser::getCmdOption(char ** begin, char ** end, const std::string & option)
{
char ** itr = std::find(begin, end, option);
if (itr != end && ++itr != end)
{
return *itr;
}
return NULL;
}
/*
Param starting index of command line
Param end index of command line
Param command line parameter
Description returns wheather a parameter is present in command Line or not
*/
bool CmdLineParser:: cmdOptionExists(char** begin, char** end, const std::string& option)
{
return std::find(begin, end, option) != end;
}