-
Notifications
You must be signed in to change notification settings - Fork 0
/
date.h
70 lines (61 loc) · 1.69 KB
/
date.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
#ifndef DATE_H_
#define DATE_H_
#include <stdbool.h>
/** Type for defining the date */
typedef struct Date_t *Date;
/**
* dateCreate: Allocates a new date.
*
* @param day - the day of the date.
* @param month - the month of the date.
* @param year - the year of the date.
* @return
* NULL - if allocation failed or date is illegal.
* A new Date in case of success.
*/
Date dateCreate(int day, int month, int year);
/**
* dateDestroy: Deallocates an existing Date.
*
* @param date - Target date to be deallocated. If priority queue is NULL nothing will be done
*/
void dateDestroy(Date date);
/**
* dateCopy: Creates a copy of target Date.
*
* @param date - Target Date.
* @return
* NULL if a NULL was sent or a memory allocation failed.
* A Date containing the same elements as date otherwise.
*/
Date dateCopy(Date date);
/**
* dateGet: Returns the number of elements in a priority queue
*
* @param date - Target Date
* @param day - the pointer to assign to day of the date into.
* @param month - the pointer to assign to month of the date into.
* @param year - the pointer to assign to year of the date into.
*
* @return
* false if one of pointers is NULL.
* Otherwise true and the date is assigned to the pointers.
*/
bool dateGet(Date date, int* day, int* month, int* year);
/**
* dateCompare: compares to dates and return which comes first
*
* @return
* A negative integer if date1 occurs first;
* 0 if they're equal or one of the given dates is NULL;
* A positive integer if date1 arrives after date2.
*/
int dateCompare(Date date1, Date date2);
/**
* dateTick: increases the date by one day, if date is NULL should do nothing.
*
* @param date - Target Date
*
*/
void dateTick(Date date);
#endif //DATE_H_