Restoring repository from code. Old repository broke and its history
[familia.git] / src / storage / individual.h
1 /****************************************************************************
2  *  Familia Lignum - Genealogical program                                   *
3  *  Copyright (C) 2011-2012 Rafał Długołęcki <rafal@dlugolecki.net.pl>      *
4  *                                                                          *
5  *  This program is free software; you can redistribute it and/or modify    *
6  *  it under the terms of the GNU General Public License as published by    *
7  *  the Free Software Foundation; version 2 of the License.                 *
8  *                                                                          *
9  *  This program is distributed in the hope that it will be useful,         *
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of          *
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           *
12  *  GNU General Public License for more details.                            *
13  *                                                                          *
14  *  You should have received a copy of the GNU General Public License along *
15  *  with this program; if not, write to the Free Software Foundation, Inc., *
16  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.             *
17  *                                                                          *
18  ****************************************************************************/
19
20 #ifndef _FAMILIA_INDIVIDUAL_H
21 #define _FAMILIA_INDIVIDUAL_H
22
23 #include "family.h"
24
25 /**
26  * Structure holding individual data.
27  */
28 struct familia_individual {
29         /** Individual identifier */
30         unsigned int id;
31         
32         /** Individual first name */
33         char * first_name;
34         
35         /** Individual last name */
36         char * last_name;
37
38         /** Individual families */
39         struct familia_family ** families;
40
41         /** Number of families */
42         unsigned int families_no;
43 };
44
45 /**
46  * Creates new individual structure
47  * @return Newly allocated individual. If allocation failed, returns NULL, like
48  *         malloc.
49  */
50 struct familia_individual * familia_individual_new();
51
52 /**
53  * Frees allocated memory of the given individual
54  * DISCLAIMER! This function does not remove linked families. You have to
55  * remove them manually from storage.
56  * @parameter individual to free
57  */
58 void familia_individual_free(struct familia_individual * individual);
59
60 /**
61  * Sets first name of the given individual
62  * @parameter individual to set first name
63  * @parameter first name to set
64  */
65 void familia_individual_set_first_name(struct familia_individual * individual, char * first_name);
66
67 /**
68  * Gets first name of the given individual
69  * @parameter individual from whom get the first name
70  * @return individuals first name
71  */
72 char * familia_individual_get_first_name(struct familia_individual * individual);
73
74 /**
75  * Sets last name of the given individual
76  * @parameter individual to set last name
77  * @parameter last name to set
78  */
79 void familia_individual_set_last_name(struct familia_individual * individual, char * last_name);
80
81 /**
82  * Gets last name of the given individual
83  * @parameter individual from whom get the last name
84  * @return individuals last name
85  */
86 char * familia_individual_get_last_name(struct familia_individual * individual);
87
88 /**
89  * Adds family to the given individual
90  * @parameter individual to set last name
91  * @parameter last name to set
92  */
93 void familia_individual_add_family(struct familia_individual * individual, struct familia_family * family);
94
95 /**
96  * Gets family with the given id of the given individual
97  * @parameter individual from whom get the family
98  * @parameter family id of the individual
99  * @return individuals last name
100  */
101 struct familia_family * familia_individual_get_family_by_id(struct familia_individual * individual, unsigned int id);
102
103 /**
104  * Removes family with the given id from the given individual
105  * DISCLAIMER! This function does not remove linked families. You have to
106  * remove them manually from storage.
107  * @parameter individual from whom family will be removed
108  * @parameter family id of the individual
109  */
110 void familia_individual_remove_family_by_id(struct familia_individual * individual, unsigned int id);
111
112 #endif /*_FAMILIA_INDIVIDUAL_H */