X-Git-Url: https://git.dlugolecki.net.pl/?a=blobdiff_plain;f=src%2Fstorage%2Findividual.h;h=745698b26c131298c4d38f8f834a4ae9a2a478bf;hb=HEAD;hp=87045c179bdefa3c9d28dfec75a1c46e5dcd099a;hpb=338b1e4b2fd96379fa007962949fa99a7e070cd6;p=familia.git diff --git a/src/storage/individual.h b/src/storage/individual.h index 87045c1..745698b 100644 --- a/src/storage/individual.h +++ b/src/storage/individual.h @@ -20,18 +20,26 @@ #ifndef _FAMILIA_INDIVIDUAL_H #define _FAMILIA_INDIVIDUAL_H +#include + #include "family.h" +/** + * @file storage/individual.h + * @brief Code for managing individuals from the family. + * + */ + /** * Structure holding individual data. */ struct familia_individual { /** Individual identifier */ unsigned int id; - + /** Individual first name */ char * first_name; - + /** Individual last name */ char * last_name; @@ -43,6 +51,13 @@ struct familia_individual { /** Parent family. Family this individual comes from. */ struct familia_family * parents; + + /** + * Birth date of individual. + * Could be exact date, range or unrecognized. You can find more info in + * gedcom-parse documentation. + */ + struct date_value * birth; }; /** @@ -54,51 +69,51 @@ struct familia_individual * familia_individual_new(); /** * Frees allocated memory of the given individual - * DISCLAIMER! This function does not free memory of linked families. You have to - * remove them manually from storage. - * @parameter individual to free + * @attention This function does not free memory of linked families. You have to + * remove them manually from @ref familia_storage, by using @ref familia_storage_free. + * @param individual individual to free */ void familia_individual_free(struct familia_individual * individual); /** * Sets first name of the given individual - * @parameter individual to set first name - * @parameter first name to set + * @param individual individual to set first name + * @param first_name first name to set */ void familia_individual_set_first_name(struct familia_individual * individual, char * first_name); /** * Gets first name of the given individual - * @parameter individual from whom get the first name + * @param individual individual from whom get the first name * @return individuals first name */ char * familia_individual_get_first_name(struct familia_individual * individual); /** * Sets last name of the given individual - * @parameter individual to set last name - * @parameter last name to set + * @param individual individual to set last name + * @param last_name last name to set */ void familia_individual_set_last_name(struct familia_individual * individual, char * last_name); /** * Gets last name of the given individual - * @parameter individual from whom get the last name + * @param individual individual from whom get the last name * @return individuals last name */ char * familia_individual_get_last_name(struct familia_individual * individual); /** * Adds family to the given individual - * @parameter individual to set last name - * @parameter last name to set + * @param individual individual to set last name + * @param family last name to set */ void familia_individual_add_family(struct familia_individual * individual, struct familia_family * family); /** * Gets family with the given id of the given individual - * @parameter individual from whom get the family - * @parameter family id of the individual + * @param individual individual from whom get the family + * @param id family id of the individual * @return selected family or NULL if such does not exists or index is out of * array bounds */ @@ -108,22 +123,21 @@ struct familia_family * familia_individual_get_family_by_id(struct familia_indiv * Removes family with the given id from the given individual * DISCLAIMER! This function does not free memory of linked families. You have to * remove them manually from storage. - * @parameter individual from whom family will be removed - * @parameter family id of the individual + * @param individual individual from whom family will be removed + * @param id family id of the individual */ void familia_individual_remove_family_by_id(struct familia_individual * individual, unsigned int id); /** * Sets parents family of the given individual - * @parameter individual to set parents - * @parameter parents to set + * @param individual individual to set parents + * @param family parents to set */ void familia_individual_set_parents(struct familia_individual * individual, struct familia_family * family); /** * Gets family with the given id of the given individual - * @parameter individual from whom get the family - * @parameter family id of the individual + * @param individual individual from whom get the parents * @return individuals last name */ struct familia_family * familia_individual_get_parents(struct familia_individual * individual); @@ -132,8 +146,24 @@ struct familia_family * familia_individual_get_parents(struct familia_individual * Removes parents from the given individual * DISCLAIMER! This function does not free memory of linked family. You have to * remove them manually from storage. - * @parameter individual from whom parents will be removed + * @param individual individual from whom parents will be removed */ void familia_individual_remove_parents(struct familia_individual * individual); +/** + * Calculates family number in order + * @return child number of individual in the given family, -1 on error or if child does not belong to family. + */ +int familia_individual_nth_child_of_family(struct familia_individual * individual, struct familia_family * family); + +/** + * Sets individual birth date. + * Date value is copied individual. Value is released on individual free(). + * @see familia_individual_free + * @param individual individual to set birth date + * @param dv date of the birth (exact, or bounds) + * @return child number of individual in the given family, -1 on error or if child does not belong to family. + */ +void familia_individual_set_birth_date(struct familia_individual * individual, struct date_value dv); + #endif /*_FAMILIA_INDIVIDUAL_H */