-
Notifications
You must be signed in to change notification settings - Fork 0
/
Options.cpp
51 lines (44 loc) · 876 Bytes
/
Options.cpp
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
50
51
//
// Options.cpp for Snake in /home/wilmot_p/PROJETS/Snake
//
// Made by WILMOT Pierre
// Login <[email protected]>
//
// Started on Mon May 7 20:52:03 2012 WILMOT Pierre
// Last update Mon May 7 21:13:05 2012 WILMOT Pierre
//
#include <stdexcept>
#include <iostream>
#include "Options.hpp"
Options::Options()
:m_fromDB(true), m_infinite(false)
{
}
Options::~Options()
{
}
void Options::parseOption(int ac, char **av)
{
std::string str;
for (int i(1) ; i < ac ; ++i)
{
str = av[i];
if (str == "--infinite")
m_infinite = true;
else if (str == "--fromDB")
m_fromDB = true;
else
{
std::cerr << "Argument Invalide : " << str << std::endl;
throw std::invalid_argument("Argument Invalide");
}
}
}
bool Options::getFromDB() const
{
return (m_fromDB);
}
bool Options::getInfinite() const
{
return (m_infinite);
}