-
Notifications
You must be signed in to change notification settings - Fork 0
/
data.h
213 lines (191 loc) · 4.61 KB
/
data.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
#ifndef DATA_H
#define DATA_H
/* define original data types. */
#include <stdio.h>
#include "list.h"
#include "simple_string.h"
#define VALUE_LENGTH 1048575
#define MODE_LENGTH 10
#define DEFAULT_LENGTH 1024
#define NUM_LENGTH 20
#define DATE_LENGTH 20
#define LIST_COUNT_PER_LIST_PAGE 15
#define LIST_COUNT_PER_SEARCH_PAGE 30
#ifndef bool
typedef enum _bool {
false = 0,
true
} bool;
#endif
typedef struct {
int id;
String* code;
int sort;
String* project_type;
int deleted;
} ProjectInfo;
ProjectInfo* project_info_new();
void project_info_free(ProjectInfo*);
typedef struct {
String* name;
String* home_description;
String* home_url;
int upload_max_size;
String* locale;
} Project;
Project* project_new();
void project_free(Project*);
typedef struct {
int element_type_id;
String* str_val;
int is_file;
} Element;
Element* element_new();
void element_free(Element*);
typedef struct {
String* name;
String* file_name;
int size;
String* mime_type;
char* content;
} SettingFile;
SettingFile* setting_file_new();
void setting_file_free(SettingFile*);
typedef struct {
int id;
List* elements;
} Message;
Message* message_new();
void message_free(Message*);
typedef struct {
int id;
int element_type_id;
String* name;
int close;
int sort;
} ListItem;
ListItem* list_item_new();
void list_item_free(ListItem*);
typedef struct {
int id;
int type;
int ticket_property;
int reply_property;
int required;
String* name;
String* description;
int auto_add_item;
String* default_value;
int display_in_list;
int sort;
} ElementType;
ElementType* element_type_new();
void element_type_free(ElementType*);
void element_type_copy(ElementType*, ElementType*);
typedef struct {
int id;
int element_type_id;
String* name;
int size;
String* mime_type;
char* content;
} ElementFile;
ElementFile* element_file_new();
void element_file_free(ElementFile*);
enum ELEM_TYPE {
ELEM_TYPE_TEXT,
ELEM_TYPE_TEXTAREA,
ELEM_TYPE_CHECKBOX,
ELEM_TYPE_LIST_SINGLE,
ELEM_TYPE_LIST_MULTI,
ELEM_TYPE_UPLOADFILE,
ELEM_TYPE_DATE,
ELEM_TYPE_LIST_SINGLE_RADIO,
ELEM_TYPE_NUM
/* this values match database value, so, if you add ELEM_TYPE, add list of tail. DBの値と連動しているので、追加する場合は、後に追加する必要がある。*/
};
enum ELEM_ID {
ELEM_ID_ID = -1,
ELEM_ID_TITLE = 1,
ELEM_ID_SENDER = 2,
ELEM_ID_STATUS = 3,
ELEM_ID_REGISTERDATE = -2,
ELEM_ID_LASTREGISTERDATE = -3,
ELEM_ID_ORG_SENDER = -4,
ELEM_ID_LASTREGISTERDATE_PASSED = -5
};
#define BASIC_ELEMENT_MAX 3
typedef struct {
int element_type_id;
int condition_type;
String* value;
String* cookie_value;
} Condition;
enum CONDITION_TYPE {
CONDITION_TYPE_NORMAL,
CONDITION_TYPE_DATE_FROM,
CONDITION_TYPE_DATE_TO,
CONDITION_TYPE_DAYS
};
Condition* condition_new();
void condition_free(Condition*);
void set_condition_values(Condition*, int, int, char*, char*, bool);
char* get_condition_value(List*, int, int);
int valid_condition_size(List*);
bool valid_condition(Condition*);
char* get_condition_valid_value(Condition*);
typedef struct {
int id;
String* name;
int count;
} State;
State* state_new();
void state_free(State*);
typedef struct {
int hit_count;
int page;
List* messages;
List* states;
List* sums;
} SearchResult;
SearchResult* search_result_new();
void search_result_free(SearchResult*);
typedef struct {
int id;
String* name;
char* content;
} Wiki;
Wiki* wiki_new();
void wiki_free(Wiki*);
char* get_element_value_by_id(List*, const int);
char* get_element_value(List*, ElementType*);
/* int get_element_lid_by_id(List*, int); */
void set_element_value(Element*, const char*);
typedef struct {
int project_id;
String* project_code;
String* project_name;
int id;
String* title;
} Ticket;
Ticket* ticket_new();
void ticket_free(Ticket*);
typedef struct {
int id;
int field_count;
} DbInfo;
typedef struct {
int all;
int not_closed;
String* day;
} BurndownChartPoint;
BurndownChartPoint* burndown_chart_point_new();
void burndown_chart_point_free(BurndownChartPoint*);
typedef struct {
String* name;
int count;
} UserRanking;
UserRanking* user_ranking_new();
void user_ranking_free(UserRanking*);
#endif
/* vim: set ts=4 sw=4 sts=4 expandtab fenc=utf-8: */