-
Notifications
You must be signed in to change notification settings - Fork 0
/
response.h
55 lines (44 loc) · 1.02 KB
/
response.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
50
51
52
53
54
// response.h
// this class holds the data for a giving response to a particular
// question
#ifndef _RESPONSE_
#define _RESPONSE_
#include <stdio.h>
#include <string.h>
#include "answer.h"
enum YN { YES, NONE };
typedef union RES_DATA *P_RES_DATA, **PP_RES_DATA;
union RES_DATA {
char *text;
int numInt;
float numFloat;
int choices[10];
};
typedef class RESPONSE *P_RESPONSE, **PP_RESPONSE;
class RESPONSE {
private:
ATYPE response_type;
RES_DATA response_data;
YN comment_status;
char *comment;
public:
RESPONSE();
RESPONSE(ATYPE rtype);
~RESPONSE();
void setData(char *s);
void setData(int i);
void setData(float f);
void setData(int i, int *iArray);
void setComment(char *s);
ATYPE getType();
void setType(ATYPE rtype) { response_type = rtype; };
const char *getTypeName();
int getIntData();
float getFloatData();
char *getTextData();
int *getChoiceRankData();
char *getComment();
void readFromDisk(FILE *fp);
void writeToDisk(FILE *fp);
};
#endif