| Kipinä internals: reference Manual |
|---|
enum KPTrainingLogError; GQuark kp_training_log_error_quark (void); #define KP_TRAINING_LOG_ERROR KPTrainingLog* kp_training_log_new (void); KPTrainingLog* kp_training_log_new_from_file (const gchar *file); void kp_training_log_destroy (KPTrainingLog *log); gboolean kp_training_log_save (KPTrainingLog *log, const gchar *file, GError **error); gboolean kp_training_log_create_html_stats (KPTrainingLog *log, const gchar *output_dir, GError **error); gboolean kp_training_log_add (KPTrainingLog *log, KPCalendarEntry *entry); gboolean kp_training_log_add_from_file (KPTrainingLog *log, const gchar *file, GError **error); gboolean kp_training_log_remove (KPTrainingLog *log, KPCalendarEntry *entry); void kp_training_log_remove_mark (KPTrainingLog *log, guint d, guint m, guint y, const gchar *mark); void kp_training_log_remove_month (KPTrainingLog *log, guint y, guint m); void kp_training_log_remove_day (KPTrainingLog *log, guint d, guint m, guint y); KPCalendarEntry* kp_training_log_get_entry (KPTrainingLog *log, guint d, guint m, guint y, const gchar *mark); TYear* kp_training_log_get_year (KPTrainingLog *log, guint year); guint kp_training_log_get_size (KPTrainingLog *log); GList* kp_training_log_get_all_entries (KPTrainingLog *log); GList* kp_training_log_get_all_entries_between (KPTrainingLog *log, GDate *start, GDate *end, GList **sports); gdouble** kp_training_log_get_workout_params_between (KPTrainingLog *log, KPTrainingLogDataModemode, const gchar *sport, const gchar *param, GDate *start, GDate *end, guint *days_between); gdouble** kp_training_log_get_workout_params_year (KPTrainingLog *log, const gchar *param, guint year, guint *days_between); GList* kp_training_log_get_day (KPTrainingLog *log, guint d, guint m, guint y); GList* kp_training_log_get_month (KPTrainingLog *log, gint year, gint month); gboolean kp_training_log_is_modified (KPTrainingLog *log); gdouble** kp_training_log_get_month_as_chart_data (KPTrainingLog *log, guint year, guint month, guint month_len, const gchar *param); gdouble kp_training_log_get_week_total (KPTrainingLog *log, GDate *date, const gchar *param); gdouble kp_training_log_get_param_day (KPTrainingLog *log, GDate *date, const gchar *param); void kp_training_log_foreach (KPTrainingLog *log, GFunc func, gpointer data); GtkTreeStore* kp_training_log_get_data_as_tree_store (KPTrainingLog *log); void kp_training_log_dump (KPTrainingLog *log);
typedef enum
{
KP_TRAINING_LOG_SAVE_HTML_ERROR,
KP_TRAINING_LOG_SAVE_ERROR,
KP_TRAINING_LOG_OPEN_ERROR,
KP_TRAINING_LOG_INTERNAL_ERROR
} KPTrainingLogError;KPTrainingLog* kp_training_log_new (void);
Create a new instance of
| Returns : | A |
KPTrainingLog* kp_training_log_new_from_file
(const gchar *file);| file : | |
| Returns : |
|
gboolean kp_training_log_save (KPTrainingLog *log,
const gchar *file,
GError **error);Just save the contents of the log to the file specified by the file.
| log : | A |
| file : | File to save log into |
| error : | |
| Returns : | TRUE if successful or FALSE otherwise. |
gboolean kp_training_log_create_html_stats
(KPTrainingLog *log,
const gchar *output_dir,
GError **error);Generate HTML statistics from data.
| log : | A |
| output_dir : | Directory to output the HTML files |
| error : | location to store possible error |
| Returns : | TRUE if successful and FALSE otherwise. |
gboolean kp_training_log_add (KPTrainingLog *log,
KPCalendarEntry *entry);Just add the calendar entry to the log.
| log : | A |
| entry : | A |
| Returns : | TRUE if the entry was added and FALSE if some error occurred. |
gboolean kp_training_log_add_from_file (KPTrainingLog *log,
const gchar *file,
GError **error);Add all the entries from the log specified by the file to the existing log.
| log : | A |
| file : | The name of the log file |
| error : | |
| Returns : | TRUE if successful and FALSE otherwise. |
gboolean kp_training_log_remove (KPTrainingLog *log,
KPCalendarEntry *entry);Just remove the calendar entry from the log.
| log : | A |
| entry : | A |
| Returns : | TRUE if the entry was removed and FALSE if some error occurred. |
void kp_training_log_remove_mark (KPTrainingLog *log,
guint d,
guint m,
guint y,
const gchar *mark);Removes the mark from the log.
| log : | a |
| d : | the day |
| m : | the month |
| y : | the year |
| mark : | the mark to remove |
void kp_training_log_remove_month (KPTrainingLog *log,
guint y,
guint m);Remove all entries in a month.
| log : | A |
| y : | the day |
| m : | the month |
void kp_training_log_remove_day (KPTrainingLog *log,
guint d,
guint m,
guint y);Remove all entries of a day.
| log : | |
| d : | the day |
| m : | the month |
| y : | the year |
KPCalendarEntry* kp_training_log_get_entry (KPTrainingLog *log,
guint d,
guint m,
guint y,
const gchar *mark);Get a
| log : | A |
| d : | Number of day between 1 and 31 |
| m : | Number of month between 1 and 12 |
| y : | Number of in format yyyy |
| mark : | |
| Returns : | A |
TYear* kp_training_log_get_year (KPTrainingLog *log,
guint year);Get a year-structure for any year. If there aren't any kp_workouts with a date in the given year in the log, NULL will be returned.
Otherwise, pointer to a TYear will be returned. It won't be copied, so it MUST NOT be freed by the caller of this function.
| log : | A |
| year : | Year in format yyyy |
| Returns : | Year-structure that represents a year. |
guint kp_training_log_get_size (KPTrainingLog *log);
Returns the number of entries in the log
| log : | A |
| Returns : | Number of entries in the log. |
GList* kp_training_log_get_all_entries (KPTrainingLog *log);
| log : | |
| Returns : |
|
GList* kp_training_log_get_all_entries_between
(KPTrainingLog *log,
GDate *start,
GDate *end,
GList **sports);| log : | |
| start : | |
| end : | |
| sports : | |
| Returns : |
|
gdouble** kp_training_log_get_workout_params_between
(KPTrainingLog *log,
KPTrainingLogDataModemode,
const gchar *sport,
const gchar *param,
GDate *start,
GDate *end,
guint *days_between);Get the distance of every kp_workout between two dates and return
data as dynamic two-dimensional array. It must be freed with
kp_array_2d_free()-func.
If days_between is not NULL, number of days between two dates will be stored in it.
| log : | A |
| Param2 : | |
| sport : | Show only params when the sport of the workout is this, NULL = all |
| param : | The name of the param |
| start : | Starting date. |
| end : | Ending date. |
| days_between : | Number of days between start and end will be stored in days_between. |
| Returns : | Two-dimensional gdouble-array of data |
gdouble** kp_training_log_get_workout_params_year
(KPTrainingLog *log,
const gchar *param,
guint year,
guint *days_between);| log : | |
| param : | |
| year : | |
| days_between : |
|
| Returns : | Two-dimensional gdouble-array of data |
GList* kp_training_log_get_day (KPTrainingLog *log,
guint d,
guint m,
guint y);Get list of all kp_workouts and other entries for any day in the log. As usual, if some error happens, NULL will be returned. Entries are not copied, so they MUST NOT be freed.
| log : | A |
| d : | Day number |
| m : | Month number (1-12) |
| y : | Year number |
| Returns : | List of all the entries in a day. |
GList* kp_training_log_get_month (KPTrainingLog *log,
gint year,
gint month);| log : | |
| year : | |
| month : | |
| Returns : |
|
gboolean kp_training_log_is_modified (KPTrainingLog *log);
| log : | |
| Returns : |
|
gdouble** kp_training_log_get_month_as_chart_data
(KPTrainingLog *log,
guint year,
guint month,
guint month_len,
const gchar *param);| log : | |
| year : | |
| month : | |
| month_len : | |
| param : | |
| Returns : |
|
gdouble kp_training_log_get_week_total (KPTrainingLog *log,
GDate *date,
const gchar *param);| log : | |
| date : | |
| param : | |
| Returns : |
|
gdouble kp_training_log_get_param_day (KPTrainingLog *log,
GDate *date,
const gchar *param);Return a double value of sum of the entries' params in a day.
| log : | A |
| date : | The date of the day as |
| param : | Param of which value to get. |
| Returns : | a gdouble which can be zero if the requested param is invalid or if its value is zero or if some other error happens. |
void kp_training_log_foreach (KPTrainingLog *log,
GFunc func,
gpointer data);Call some function for each entry in the log.
NOTE: This function can not be used to remove all the entries
from the log, because kp_training_log_remove() may destroy some
structures which are needed to iterate the log! So you must
use kp_training_log_remove_all()
| log : | A |
| func : | A func to execute |
| data : | Data to pass to the func |
GtkTreeStore* kp_training_log_get_data_as_tree_store
(KPTrainingLog *log);| log : | |
| Returns : |
|
void kp_training_log_dump (KPTrainingLog *log);
Dump the contents of the log to stdout. Could be used for debugging.
| log : | A |
| <<< Data structures to store workouts and other entries. | kpcalendarentry >>> |