1 /****************************************************************************
2 * Familia Lignum - Genealogical program *
3 * Copyright (C) 2011-2012 Rafał Długołęcki <rafal@dlugolecki.net.pl> *
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. *
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. *
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. *
18 ****************************************************************************/
20 #ifndef _FAMILIA_INDIVIDUAL_H
21 #define _FAMILIA_INDIVIDUAL_H
26 * Structure holding individual data.
28 struct familia_individual {
29 /** Individual identifier */
32 /** Individual first name */
35 /** Individual last name */
38 /** Individual families */
39 struct familia_family ** families;
41 /** Number of families */
42 unsigned int families_no;
44 /** Parent family. Family this individual comes from. */
45 struct familia_family * parents;
49 * Creates new individual structure
50 * @return Newly allocated individual. If allocation failed, returns NULL, like
53 struct familia_individual * familia_individual_new();
56 * Frees allocated memory of the given individual
57 * DISCLAIMER! This function does not free memory of linked families. You have to
58 * remove them manually from storage.
59 * @parameter individual to free
61 void familia_individual_free(struct familia_individual * individual);
64 * Sets first name of the given individual
65 * @parameter individual to set first name
66 * @parameter first name to set
68 void familia_individual_set_first_name(struct familia_individual * individual, char * first_name);
71 * Gets first name of the given individual
72 * @parameter individual from whom get the first name
73 * @return individuals first name
75 char * familia_individual_get_first_name(struct familia_individual * individual);
78 * Sets last name of the given individual
79 * @parameter individual to set last name
80 * @parameter last name to set
82 void familia_individual_set_last_name(struct familia_individual * individual, char * last_name);
85 * Gets last name of the given individual
86 * @parameter individual from whom get the last name
87 * @return individuals last name
89 char * familia_individual_get_last_name(struct familia_individual * individual);
92 * Adds family to the given individual
93 * @parameter individual to set last name
94 * @parameter last name to set
96 void familia_individual_add_family(struct familia_individual * individual, struct familia_family * family);
99 * Gets family with the given id of the given individual
100 * @parameter individual from whom get the family
101 * @parameter family id of the individual
102 * @return selected family or NULL if such does not exists or index is out of
105 struct familia_family * familia_individual_get_family_by_id(struct familia_individual * individual, unsigned int id);
108 * Removes family with the given id from the given individual
109 * DISCLAIMER! This function does not free memory of linked families. You have to
110 * remove them manually from storage.
111 * @parameter individual from whom family will be removed
112 * @parameter family id of the individual
114 void familia_individual_remove_family_by_id(struct familia_individual * individual, unsigned int id);
117 * Sets parents family of the given individual
118 * @parameter individual to set parents
119 * @parameter parents to set
121 void familia_individual_set_parents(struct familia_individual * individual, struct familia_family * family);
124 * Gets family with the given id of the given individual
125 * @parameter individual from whom get the family
126 * @parameter family id of the individual
127 * @return individuals last name
129 struct familia_family * familia_individual_get_parents(struct familia_individual * individual);
132 * Removes parents from the given individual
133 * DISCLAIMER! This function does not free memory of linked family. You have to
134 * remove them manually from storage.
135 * @parameter individual from whom parents will be removed
137 void familia_individual_remove_parents(struct familia_individual * individual);
139 #endif /*_FAMILIA_INDIVIDUAL_H */