-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcmdparams.h
49 lines (39 loc) · 1.19 KB
/
cmdparams.h
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
#ifndef CMDPARAMS_H
#define CMDPARAMS_H
#include <string>
#include <iostream>
#include "constants.h"
class CmdParams
{
public:
CmdParams(int argc, char* argv[]);
~CmdParams();
void showUsage();
int getNumColumns() const;
void setNumColumns(int value);
int getNumRows() const;
void setNumRows(int value);
int getMaxLengthValue() const;
void setMaxLengthValue(int value);
std::string getEncoding() const;
void setEncoding(const std::string &value);
std::string getOutputFileName() const;
void setOutputFileName(const std::string &value);
bool isValid();
private:
int numColumns{defaultNumColumns};
int numRows{defaultNumRows};
int maxLengthValue{defaultMaxLengthValue};
std::string encoding{defaultEncoding};
std::string outputFileName;
std::string appName;
bool noErrors{true};
void parseParams(int argc, char* argv[]);
void errorCountArguments(int count);
int checkArgNum(std::string num);
int convertToInt(std::string value);
void showErrNoValue(std::string option);
bool isValidOption(std::string option);
void setParams(std::string option, std::string value);
};
#endif // CMDPARAMS_H