GnuCash
5.6-150-g038405b370+
|
#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 | GncSxInstances |
struct | GncSxVariable |
struct | GncSxInstance |
struct | GncSxVariableNeeded |
struct | GncSxSummary |
Macros | |
#define | GNC_TYPE_SX_INSTANCE_MODEL (gnc_sx_instance_model_get_type ()) |
Functions | |
GncSxInstanceModel * | gnc_sx_get_current_instances (void) |
Shorthand for get_instances(now, FALSE);. | |
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. More... | |
void | gnc_sx_instance_model_update_sx_instances (GncSxInstanceModel *model, SchedXaction *sx) |
Regenerates and updates the GncSxInstances* for the given SX. More... | |
void | gnc_sx_instance_model_remove_sx_instances (GncSxInstanceModel *model, SchedXaction *sx) |
void | gnc_sx_scrub_split_numerics (gpointer psplit, gpointer user) |
Fix up numerics where they've gotten out-of-sync with the formulas. More... | |
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) |
There is a constraint around a sequence of upcoming instance states. More... | |
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) |
Really ("effectively") create the transactions from the SX instances in the given model. More... | |
void | gnc_sx_instance_model_summarize (GncSxInstanceModel *model, GncSxSummary *summary) |
void | gnc_sx_summary_print (const GncSxSummary *summary) |
Debug output to trace file. | |
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) |
Returns a GHashTable<GUID*, gnc_numeric*> with no destructor for the key, but a destructor for the value set. More... | |
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. More... | |
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. More... | |
GList * | gnc_sx_instance_model_get_sx_instances_list (GncSxInstanceModel *model) |
Returns the list of GncSxInstances in the model (Each element in the list has type GncSxInstances) More... | |
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 1671 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 1904 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 1919 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 568 of file gnc-sx-instance-model.c.
GList* gnc_sx_instance_get_variables | ( | GncSxInstance * | inst | ) |
Definition at line 475 of file gnc-sx-instance-model.c.
GHashTable* gnc_sx_instance_get_variables_for_parser | ( | GHashTable * | instance_var_hash | ) |
Definition at line 225 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 1508 of file gnc-sx-instance-model.c.
GList* gnc_sx_instance_model_check_variables | ( | GncSxInstanceModel * | model | ) |
Definition at line 1569 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 1397 of file gnc-sx-instance-model.c.
GList* gnc_sx_instance_model_get_sx_instances_list | ( | GncSxInstanceModel * | model | ) |
Returns the list of GncSxInstances in the model (Each element in the list has type GncSxInstances)
The returned list is owned by the model
Definition at line 1929 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 1604 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 850 of file gnc-sx-instance-model.c.
void gnc_sx_scrub_split_numerics | ( | gpointer | psplit, |
gpointer | user | ||
) |
Fix up numerics where they've gotten out-of-sync with the formulas.
Ideally this would be done at load time, but it requires gnc_exp_parser to work and neither engine nor the backends can depend on it.
Definition at line 154 of file gnc-sx-instance-model.c.