GnuCash
2.6.99
|
#include "config.h"
#include <glib.h>
#include <glib-object.h>
#include "gnc-numeric.h"
#include "SchedXaction.h"
Go to the source code of this file.
Data Structures | |
struct | _GncSxInstanceModel |
struct | _GncSxInstanceModelClass |
struct | _GncSxInstances |
struct | _GncSxVariable |
struct | _GncSxInstance |
struct | _GncSxVariableNeeded |
struct | _GncSxSummary |
Macros | |
#define | GNC_TYPE_SX_INSTANCE_MODEL (gnc_sx_instance_model_get_type ()) |
#define | GNC_SX_INSTANCE_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_SX_INSTANCE_MODEL, GncSxInstanceModel)) |
#define | GNC_SX_INSTANCE_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_SX_INSTANCE_MODEL, GncSxInstanceModelClass)) |
#define | GNC_IS_SX_INSTANCE_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_SX_INSTANCE_MODEL)) |
#define | GNC_IS_SX_INSTANCE_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_SX_INSTANCE_MODEL)) |
#define | GNC_SX_INSTANCE_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_SX_INSTANCE_MODEL, GncSxInstanceModelClass)) |
Typedefs | |
typedef struct _GncSxInstanceModel | GncSxInstanceModel |
typedef struct _GncSxInstanceModelClass | GncSxInstanceModelClass |
typedef struct _GncSxInstances | GncSxInstances |
typedef struct _GncSxVariable | GncSxVariable |
typedef struct _GncSxInstance | GncSxInstance |
typedef struct _GncSxVariableNeeded | GncSxVariableNeeded |
typedef struct _GncSxSummary | GncSxSummary |
Functions | |
GType | gnc_sx_instance_model_get_type (void) |
GncSxInstanceModel * | gnc_sx_get_current_instances (void) |
GncSxInstanceModel * | gnc_sx_get_instances (const GDate *range_end, gboolean include_disabled) |
void | gnc_sx_instance_model_update_sx_instances (GncSxInstanceModel *model, SchedXaction *sx) |
void | gnc_sx_instance_model_remove_sx_instances (GncSxInstanceModel *model, SchedXaction *sx) |
GList * | gnc_sx_instance_get_variables (GncSxInstance *inst) |
Account * | gnc_sx_get_template_transaction_account (const SchedXaction *sx) |
GHashTable * | gnc_sx_instance_get_variables_for_parser (GHashTable *instance_var_hash) |
GncSxVariable * | gnc_sx_variable_new_full (gchar *name, gnc_numeric value, gboolean editable) |
void | gnc_sx_variable_free (GncSxVariable *var) |
void | gnc_sx_instance_model_change_instance_state (GncSxInstanceModel *model, GncSxInstance *instance, GncSxInstanceState new_state) |
void | gnc_sx_instance_model_set_variable (GncSxInstanceModel *model, GncSxInstance *instance, GncSxVariable *variable, gnc_numeric *new_value) |
GList * | gnc_sx_instance_model_check_variables (GncSxInstanceModel *model) |
void | gnc_sx_instance_model_effect_change (GncSxInstanceModel *model, gboolean auto_create_only, GList **created_transaction_guids, GList **creation_errors) |
void | gnc_sx_instance_model_summarize (GncSxInstanceModel *model, GncSxSummary *summary) |
void | gnc_sx_summary_print (const GncSxSummary *summary) |
void | gnc_sx_get_variables (SchedXaction *sx, GHashTable *var_hash) |
int | gnc_sx_parse_vars_from_formula (const char *formula, GHashTable *var_hash, gnc_numeric *result) |
void | gnc_sx_randomize_variables (GHashTable *vars) |
GHashTable * | gnc_g_hash_new_guid_numeric (void) |
void | gnc_sx_all_instantiate_cashflow (GList *all_sxes, const GDate *range_start, const GDate *range_end, GHashTable *map, GList **creation_errors) |
GHashTable * | gnc_sx_all_instantiate_cashflow_all (GDate range_start, GDate range_end) |
GHashTable* gnc_g_hash_new_guid_numeric | ( | void | ) |
Returns a GHashTable<GUID*, gnc_numeric*> with no destructor for the key, but a destructor for the value set.
The returned value must be free'd with g_hash_table_destroy or g_hash_table_unref.
Definition at line 1474 of file gnc-sx-instance-model.c.
void gnc_sx_all_instantiate_cashflow | ( | GList * | all_sxes, |
const GDate * | range_start, | ||
const GDate * | range_end, | ||
GHashTable * | map, | ||
GList ** | creation_errors | ||
) |
Instantiates the cash flow of all given SXs (in the given GList<SchedXAction*>) into the GHashTable<GUID*, gnc_numeric*> for the given date range. Each SX is counted with multiplicity as it has occurrences in the given date range.
The creation_errors list, if non-NULL, receive any errors that occurred during creation, similar as in gnc_sx_instance_model_effect_change().
Definition at line 1720 of file gnc-sx-instance-model.c.
GHashTable* gnc_sx_all_instantiate_cashflow_all | ( | GDate | range_start, |
GDate | range_end | ||
) |
Simplified wrapper around gnc_sx_all_instantiate_cashflow(): Run that function on all SX of the current book for the given date range. Ignore any potential error messages. Returns a newly allocated GHashTable with the result, which is a GHashTable<GUID*, gnc_numeric*>, identical to what gnc_g_hash_new_guid_numeric() would return. The returned value must be free'd with g_hash_table_destroy.
Definition at line 1735 of file gnc-sx-instance-model.c.
GncSxInstanceModel* gnc_sx_get_current_instances | ( | void | ) |
Shorthand for get_instances(now, FALSE);
Definition at line 410 of file gnc-sx-instance-model.c.
GncSxInstanceModel* gnc_sx_get_instances | ( | const GDate * | range_end, |
gboolean | include_disabled | ||
) |
Allocates a new SxInstanceModel and fills it with generated instances for all scheduled transactions up to the given range_end date.
The caller must unref the returned object by g_object_unref(G_OBJECT(inst_model)); when no longer in use.
Definition at line 419 of file gnc-sx-instance-model.c.
GList* gnc_sx_instance_get_variables | ( | GncSxInstance * | inst | ) |
Definition at line 337 of file gnc-sx-instance-model.c.
GHashTable* gnc_sx_instance_get_variables_for_parser | ( | GHashTable * | instance_var_hash | ) |
Definition at line 100 of file gnc-sx-instance-model.c.
void gnc_sx_instance_model_change_instance_state | ( | GncSxInstanceModel * | model, |
GncSxInstance * | instance, | ||
GncSxInstanceState | new_state | ||
) |
There is a constraint around a sequence of upcoming instance states. In short: the last-created state and a list of postponed instances are modeled, but upcoming reminders are not. As such, a reminder can never be before any other (modeled) instance type. For instance, the following sequences are disallowed:
[...] remind <- will be lost/skipped over; must be converted to postponed
. to-create <- this will be the last-recorded state. [...]
[...] remind <- same as previous; will be lost/skipped; must be postponed
. postponed [...]
remind <- same... ignore [...]
As such, the SinceLastRun model will enforce that there are no previous remind
instances at every state change. They will be silently converted to postponed
-state transactions.
Definition at line 1311 of file gnc-sx-instance-model.c.
GList* gnc_sx_instance_model_check_variables | ( | GncSxInstanceModel * | model | ) |
Definition at line 1372 of file gnc-sx-instance-model.c.
void gnc_sx_instance_model_effect_change | ( | GncSxInstanceModel * | model, |
gboolean | auto_create_only, | ||
GList ** | created_transaction_guids, | ||
GList ** | creation_errors | ||
) |
Really ("effectively") create the transactions from the SX instances in the given model.
Definition at line 1219 of file gnc-sx-instance-model.c.
void gnc_sx_instance_model_summarize | ( | GncSxInstanceModel * | model, |
GncSxSummary * | summary | ||
) |
summary | Caller-provided, populated with a summarization of the state of the model. Specifically, used to determine if there are SLR SXes that need either auto-creation or user-interaction. |
Definition at line 1407 of file gnc-sx-instance-model.c.
void gnc_sx_instance_model_update_sx_instances | ( | GncSxInstanceModel * | model, |
SchedXaction * | sx | ||
) |
Regenerates and updates the GncSxInstances* for the given SX. Model consumers are probably going to call this in response to seeing the "update" signal, unless they need to be doing something else like finishing an iteration over an existing GncSxInstances*.
Definition at line 725 of file gnc-sx-instance-model.c.
void gnc_sx_summary_print | ( | const GncSxSummary * | summary | ) |
Debug output to trace file
Definition at line 1459 of file gnc-sx-instance-model.c.