-
Notifications
You must be signed in to change notification settings - Fork 0
/
Arguments.h
35 lines (28 loc) · 885 Bytes
/
Arguments.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
#ifndef ARGUMENTS_CLASS
#define ARGUMENTS_CLASS
#include <stdbool.h>
#include "File.h"
#include "StringList.h"
typedef struct ProgramArgsObj ProgramArgs;
struct ProgramArgsClass_t {
ProgramArgs* (*new)(void);
void (*delete)(ProgramArgs **obj);
void (*print)(ProgramArgs *obj);
bool (*debug)(void);
size_t objSize;
};
struct ProgramArgsMethods {
void (*set)(ProgramArgs *self, const char **argv, const int argc);
int (*getNumArgs)(const ProgramArgs *self);
const String* (*get)(const ProgramArgs *self, const int index);
bool (*areValid)(const ProgramArgs *self);
bool (*operationRequested)(const ProgramArgs *self, const char operation);
File* (*getSecondArgAsFile)(const ProgramArgs *self);
};
struct ProgramArgsObj {
String *progName;
StringList *args;
const struct ProgramArgsMethods *methods;
};
extern const struct ProgramArgsClass_t ProgramArgsClass;
#endif