File: task.h

package info (click to toggle)
gtimer 0.96-1
  • links: PTS
  • area: main
  • in suites: hamm, slink
  • size: 340 kB
  • ctags: 279
  • sloc: ansic: 3,409; makefile: 137
file content (79 lines) | stat: -rw-r--r-- 2,438 bytes parent folder | download
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
/*
 * Definition for a task
 *
 * Copyright:
 *	(C) 1998 Craig Knudsen, cknudsen@radix.net
 *	See accompanying file "COPYING".
 * 
 *	This program is free software; you can redistribute it and/or
 *	modify it under the terms of the GNU General Public License
 *	as published by the Free Software Foundation; either version 2
 *	of the License, or (at your option) any later version.
 * 
 *	This program is distributed in the hope that it will be useful,
 *	but WITHOUT ANY WARRANTY; without even the implied warranty of
 *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *	GNU General Public License for more details.
 * 
 *	You should have received a copy of the GNU General Public License
 *	along with this program; if not, write to the
 *	Free Software Foundation, Inc., 59 Temple Place,
 *	Suite 330, Boston, MA  02111-1307, USA
 *
 */


#ifndef _TASK_H
#define _TASK_H

#define TASK_DIRECTORY		".gtimer"	/* from $HOME */

/* Errors */
#define TASK_ERROR_SYSTEM_ERROR	1	/* check errno value */
#define TASK_ERROR_BAD_FILE	2	/* bad file format */

typedef struct {
  int seconds;		/* time in seconds */
  int mon, mday, year;	/* MM/DD/YYYY */
} TaskTimeEntry;

typedef struct {
  char *text;		/* text of annotiation */
  time_t text_time;	/* GMT of annotation */
} TaskAnnotation;

typedef struct {
  char *name;			/* name of task */
  TaskTimeEntry **entries;	/* entries */
  int num_entries;		/* number entries (dates) */
  time_t created;		/* time created */
  int number;			/* unique task id number */
  TaskAnnotation **annotations;	/* annotations */
  int num_annotations;		/* size of above array */
} Task;

/*
 * Functions
 */


void taskAdd ( Task *task );
int taskSave ( Task *task, char *taskdir );
int taskSaveAll ( char *taskdir );
int taskLoad ( char *file, Task **task );
int taskLoadAll ( char *taskdir );
Task *taskCreate ( char *name );
int taskDelete ( Task *task, char *taskdir );
void taskFree ();
int taskCount ();
Task *taskGet ( int number );
Task *taskGetFirst ();
Task *taskGetNext ();
TaskTimeEntry *taskGetTimeEntry ( Task *task, int year, int month, int day );
TaskTimeEntry *taskNewTimeEntry ( Task *task, int year, int month, int day );
void taskAddAnnotation ( Task *task, char *taskdir, char *text );
TaskAnnotation **TaskGetAnnotationEntries ( Task *task, int year,
  int month, int day, int time_offset, int *num_ret );
char *taskErrorString ( int task_error );

#endif /* _TASK_H */