individual->families = NULL;
individual->families_no = 0;
individual->parents = NULL;
+ individual->birth = NULL;
return individual;
}
individual->parents = NULL;
}
+ if (individual->birth) {
+ free(individual->birth);
+ individual->birth = NULL;
+ }
+
free(individual);
}
{
individual->parents = NULL;
}
+
+int familia_individual_nth_child_of_family(struct familia_individual * individual, struct familia_family * family)
+{
+ unsigned int i;
+ unsigned int children_no = family->children_no;
+
+ for (i = 0; i < children_no; i++) {
+ if (family->children[i]->id == individual->id) {
+ return i;
+ }
+ }
+
+ return -1;
+}
+
+void familia_individual_set_birth_date(struct familia_individual * individual, struct date_value dv)
+{
+ /* TODO: Add multiple birth dates (in case there are many different sources) */
+ if (!individual->birth) {
+ struct date_value * date = NULL;
+ date = gedcom_new_date_value(NULL);
+
+ /* Just copy parsed date_value to newly allocated variable... */
+ memcpy(date, &dv, sizeof(struct date_value));
+ individual->birth = date;
+ }
+ else {
+ fprintf(stderr, "> Date has been already set, ignoring new one: %s\n", gedcom_date_to_string(&dv));
+ }
+}
\ No newline at end of file