Add mouse vertical scrolling.
[familia.git] / src / storage / individual.h
index cd4d448e675c7e914bb27c80a5e5456ef85c94af..745698b26c131298c4d38f8f834a4ae9a2a478bf 100644 (file)
 #ifndef _FAMILIA_INDIVIDUAL_H
 #define _FAMILIA_INDIVIDUAL_H
 
+#include <gedcom.h>
+
 #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;
 
@@ -40,6 +48,16 @@ struct familia_individual {
 
        /** Number of families */
        unsigned int families_no;
+
+       /** 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;
 };
 
 /**
@@ -51,62 +69,101 @@ struct familia_individual * familia_individual_new();
 
 /**
  * Frees allocated memory of the given individual
- * DISCLAIMER! This function does not remove 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
- * @return individuals last name
+ * @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
  */
 struct familia_family * familia_individual_get_family_by_id(struct familia_individual * individual, unsigned int id);
 
 /**
  * Removes family with the given id from the given individual
- * DISCLAIMER! This function does not remove linked families. You have to
+ * 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
+ * @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
+ * @param individual individual from whom get the parents
+ * @return individuals last name
+ */
+struct familia_family * familia_individual_get_parents(struct familia_individual * 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.
+ * @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 */