White space removal and change tabs to spaces in qofbook.cpp/h

This commit is contained in:
Robert Fewell 2018-08-25 11:08:32 +01:00
parent fd750a22eb
commit 2dcb316280
2 changed files with 59 additions and 58 deletions

View File

@ -66,30 +66,30 @@ static QofLogModule log_module = QOF_MOD_ENGINE;
enum enum
{ {
PROP_0, PROP_0,
// PROP_ROOT_ACCOUNT, /* Table */ // PROP_ROOT_ACCOUNT, /* Table */
// PROP_ROOT_TEMPLATE, /* Table */ // PROP_ROOT_TEMPLATE, /* Table */
/* keep trading accounts property, while adding book-currency, default gains /* keep trading accounts property, while adding book-currency, default gains
policy and default gains account properties, so that files prior to 2.7 can policy and default gains account properties, so that files prior to 2.7 can
be read/processed; GUI changed to use all four properties as of 2.7. be read/processed; GUI changed to use all four properties as of 2.7.
Trading accounts, on the one hand, and book-currency plus default-gains- Trading accounts, on the one hand, and book-currency plus default-gains-
policy, and optionally, default gains account, on the other, are mutually policy, and optionally, default gains account, on the other, are mutually
exclusive */ exclusive */
PROP_OPT_TRADING_ACCOUNTS, /* KVP */ PROP_OPT_TRADING_ACCOUNTS, /* KVP */
/* Book currency and default gains policy properties only apply if currency /* Book currency and default gains policy properties only apply if currency
accounting method selected in GUI is 'book-currency'; both required and accounting method selected in GUI is 'book-currency'; both required and
both are exclusive with trading accounts */ both are exclusive with trading accounts */
PROP_OPT_BOOK_CURRENCY, /* KVP */ PROP_OPT_BOOK_CURRENCY, /* KVP */
PROP_OPT_DEFAULT_GAINS_POLICY, /* KVP */ PROP_OPT_DEFAULT_GAINS_POLICY, /* KVP */
/* Default gains account property only applies if currency accounting method /* Default gains account property only applies if currency accounting method
selected in GUI is 'book-currency'; its use is optional but exclusive with selected in GUI is 'book-currency'; its use is optional but exclusive with
trading accounts */ trading accounts */
PROP_OPT_DEFAULT_GAINS_ACCOUNT_GUID, /* KVP */ PROP_OPT_DEFAULT_GAINS_ACCOUNT_GUID, /* KVP */
PROP_OPT_AUTO_READONLY_DAYS,/* KVP */ PROP_OPT_AUTO_READONLY_DAYS, /* KVP */
PROP_OPT_NUM_FIELD_SOURCE, /* KVP */ PROP_OPT_NUM_FIELD_SOURCE, /* KVP */
PROP_OPT_DEFAULT_BUDGET, /* KVP */ PROP_OPT_DEFAULT_BUDGET, /* KVP */
PROP_OPT_FY_END, /* KVP */ PROP_OPT_FY_END, /* KVP */
PROP_AB_TEMPLATES, /* KVP */ PROP_AB_TEMPLATES, /* KVP */
N_PROPERTIES /* Just a counter */ N_PROPERTIES /* Just a counter */
}; };
static void static void
@ -167,9 +167,9 @@ static const std::string str_OPTION_NAME_NUM_FIELD_SOURCE(OPTION_NAME_NUM_FIELD_
static void static void
qof_book_get_property (GObject* object, qof_book_get_property (GObject* object,
guint prop_id, guint prop_id,
GValue* value, GValue* value,
GParamSpec* pspec) GParamSpec* pspec)
{ {
QofBook *book; QofBook *book;
gchar *key; gchar *key;
@ -221,9 +221,9 @@ qof_book_get_property (GObject* object,
static void static void
qof_book_set_property (GObject *object, qof_book_set_property (GObject *object,
guint prop_id, guint prop_id,
const GValue *value, const GValue *value,
GParamSpec *pspec) GParamSpec *pspec)
{ {
QofBook *book; QofBook *book;
gchar *key; gchar *key;
@ -288,9 +288,9 @@ qof_book_class_init (QofBookClass *klass)
PROP_OPT_TRADING_ACCOUNTS, PROP_OPT_TRADING_ACCOUNTS,
g_param_spec_string("trading-accts", g_param_spec_string("trading-accts",
"Use Trading Accounts", "Use Trading Accounts",
"Scheme true ('t') or NULL. If 't', then the book " "Scheme true ('t') or NULL. If 't', then the book "
"uses trading accounts for managing multiple-currency " "uses trading accounts for managing multiple-currency "
"transactions.", "transactions.",
NULL, NULL,
G_PARAM_READWRITE)); G_PARAM_READWRITE));
@ -299,9 +299,9 @@ qof_book_class_init (QofBookClass *klass)
PROP_OPT_BOOK_CURRENCY, PROP_OPT_BOOK_CURRENCY,
g_param_spec_string("book-currency", g_param_spec_string("book-currency",
"Select Book Currency", "Select Book Currency",
"The reference currency used to manage multiple-currency " "The reference currency used to manage multiple-currency "
"transactions when 'book-currency' currency accounting method " "transactions when 'book-currency' currency accounting method "
"selected; requires valid default gains/loss policy.", "selected; requires valid default gains/loss policy.",
NULL, NULL,
G_PARAM_READWRITE)); G_PARAM_READWRITE));
@ -310,10 +310,10 @@ qof_book_class_init (QofBookClass *klass)
PROP_OPT_DEFAULT_GAINS_POLICY, PROP_OPT_DEFAULT_GAINS_POLICY,
g_param_spec_string("default-gains-policy", g_param_spec_string("default-gains-policy",
"Select Default Gains Policy", "Select Default Gains Policy",
"The default policy to be used to calculate gains/losses on " "The default policy to be used to calculate gains/losses on "
"dispositions of currencies/commodities other than " "dispositions of currencies/commodities other than "
"'book-currency' when 'book-currency' currency accounting " "'book-currency' when 'book-currency' currency accounting "
"method selected; requires valid book-currency.", "method selected; requires valid book-currency.",
NULL, NULL,
G_PARAM_READWRITE)); G_PARAM_READWRITE));
@ -322,10 +322,10 @@ qof_book_class_init (QofBookClass *klass)
PROP_OPT_DEFAULT_GAINS_ACCOUNT_GUID, PROP_OPT_DEFAULT_GAINS_ACCOUNT_GUID,
g_param_spec_boxed("default-gain-loss-account-guid", g_param_spec_boxed("default-gain-loss-account-guid",
"Select Default Gain/Loss Account", "Select Default Gain/Loss Account",
"The default account to be used for calculated gains/losses on " "The default account to be used for calculated gains/losses on "
"dispositions of currencies/commodities other than " "dispositions of currencies/commodities other than "
"'book-currency' when 'book-currency' currency accounting " "'book-currency' when 'book-currency' currency accounting "
"method selected; requires valid book-currency.", "method selected; requires valid book-currency.",
GNC_TYPE_GUID, GNC_TYPE_GUID,
G_PARAM_READWRITE)); G_PARAM_READWRITE));
@ -334,8 +334,8 @@ qof_book_class_init (QofBookClass *klass)
PROP_OPT_NUM_FIELD_SOURCE, PROP_OPT_NUM_FIELD_SOURCE,
g_param_spec_string(PARAM_NAME_NUM_FIELD_SOURCE, g_param_spec_string(PARAM_NAME_NUM_FIELD_SOURCE,
"Use Split-Action in the Num Field", "Use Split-Action in the Num Field",
"Scheme true ('t') or NULL. If 't', then the book " "Scheme true ('t') or NULL. If 't', then the book "
"will put the split action value in the Num field.", "will put the split action value in the Num field.",
NULL, NULL,
G_PARAM_READWRITE)); G_PARAM_READWRITE));
@ -344,11 +344,11 @@ qof_book_class_init (QofBookClass *klass)
PROP_OPT_AUTO_READONLY_DAYS, PROP_OPT_AUTO_READONLY_DAYS,
g_param_spec_double("autoreadonly-days", g_param_spec_double("autoreadonly-days",
"Transaction Auto-read-only Days", "Transaction Auto-read-only Days",
"Prevent editing of transactions posted more than " "Prevent editing of transactions posted more than "
"this many days ago.", "this many days ago.",
0, 0,
G_MAXDOUBLE, G_MAXDOUBLE,
0, 0,
G_PARAM_READWRITE)); G_PARAM_READWRITE));
g_object_class_install_property g_object_class_install_property
@ -365,7 +365,7 @@ qof_book_class_init (QofBookClass *klass)
g_param_spec_boxed("fy-end", g_param_spec_boxed("fy-end",
"Book Fiscal Year End", "Book Fiscal Year End",
"A GDate with a bogus year having the last Month and " "A GDate with a bogus year having the last Month and "
"Day of the Fiscal year for the book.", "Day of the Fiscal year for the book.",
G_TYPE_DATE, G_TYPE_DATE,
G_PARAM_READWRITE)); G_PARAM_READWRITE));
g_object_class_install_property g_object_class_install_property
@ -561,7 +561,7 @@ qof_book_set_data_fin (QofBook *book, const char *key, gpointer data, QofBookFin
if (!cb) return; if (!cb) return;
g_hash_table_insert (book->data_table_finalizers, (gpointer)key, g_hash_table_insert (book->data_table_finalizers, (gpointer)key,
reinterpret_cast<void*>(cb)); reinterpret_cast<void*>(cb));
} }
gpointer gpointer
@ -979,8 +979,8 @@ qof_book_get_book_currency_name (QofBook *book)
{ {
const gchar *opt = NULL; const gchar *opt = NULL;
qof_instance_get (QOF_INSTANCE (book), qof_instance_get (QOF_INSTANCE (book),
"book-currency", &opt, "book-currency", &opt,
NULL); NULL);
return opt; return opt;
} }
@ -994,8 +994,8 @@ qof_book_get_default_gains_policy (QofBook *book)
{ {
const gchar *opt = NULL; const gchar *opt = NULL;
qof_instance_get (QOF_INSTANCE (book), qof_instance_get (QOF_INSTANCE (book),
"default-gains-policy", &opt, "default-gains-policy", &opt,
NULL); NULL);
return opt; return opt;
} }
@ -1009,8 +1009,8 @@ qof_book_get_default_gain_loss_acct_guid (QofBook *book)
{ {
GncGUID *guid = NULL; GncGUID *guid = NULL;
qof_instance_get (QOF_INSTANCE (book), qof_instance_get (QOF_INSTANCE (book),
"default-gain-loss-account-guid", &guid, "default-gain-loss-account-guid", &guid,
NULL); NULL);
return guid; return guid;
} }
@ -1021,8 +1021,8 @@ qof_book_use_trading_accounts (const QofBook *book)
{ {
const char *opt = NULL; const char *opt = NULL;
qof_instance_get (QOF_INSTANCE (book), qof_instance_get (QOF_INSTANCE (book),
"trading-accts", &opt, "trading-accts", &opt,
NULL); NULL);
if (opt && opt[0] == 't' && opt[1] == 0) if (opt && opt[0] == 't' && opt[1] == 0)
return TRUE; return TRUE;
return FALSE; return FALSE;
@ -1225,7 +1225,7 @@ qof_book_load_options (QofBook *book, GNCOptionLoad load_cb, GNCOptionDB *odb)
void void
qof_book_save_options (QofBook *book, GNCOptionSave save_cb, qof_book_save_options (QofBook *book, GNCOptionSave save_cb,
GNCOptionDB* odb, gboolean clear) GNCOptionDB* odb, gboolean clear)
{ {
/* Wrap this in begin/commit so that it commits only once instead of doing /* Wrap this in begin/commit so that it commits only once instead of doing
* so for every option. Qof_book_set_option will take care of dirtying the * so for every option. Qof_book_set_option will take care of dirtying the

View File

@ -148,15 +148,16 @@ struct _QofBook
* from the session. Better solutions welcome ... */ * from the session. Better solutions welcome ... */
QofBackend *backend; QofBackend *backend;
/* A cached value of the OPTION_NAME_NUM_FIELD_SOURCE option value because /* A cached value of the OPTION_NAME_NUM_FIELD_SOURCE option value
* it is queried quite a lot, so we want to avoid a KVP lookup on each query * because it is queried quite a lot, so we want to avoid a KVP
*/ * lookup on each query */
gboolean cached_num_field_source; gboolean cached_num_field_source;
/* Whether the above cached value is valid. */ /* Whether the above cached value is valid. */
gboolean cached_num_field_source_isvalid; gboolean cached_num_field_source_isvalid;
/* A cahed value of the "autoreadonly-days" option value because it is /* A cahed value of the "autoreadonly-days" option value because
* queried quite a lot, so we want to avoid a KVP lookup on each query */ * it is queried quite a lot, so we want to avoid a KVP lookup on
* each query */
gint cached_num_days_autoreadonly; gint cached_num_days_autoreadonly;
/* Whether the above cached value is valid. */ /* Whether the above cached value is valid. */
gboolean cached_num_days_autoreadonly_isvalid; gboolean cached_num_days_autoreadonly_isvalid;
@ -180,7 +181,7 @@ GType qof_book_get_type(void);
* but not somewhere inline in the code. */ * but not somewhere inline in the code. */
#define QOF_BOOK_RETURN_ENTITY(book,guid,e_type,c_type) { \ #define QOF_BOOK_RETURN_ENTITY(book,guid,e_type,c_type) { \
QofInstance *val = NULL; \ QofInstance *val = NULL; \
if ((guid != NULL) && (book != NULL)) { \ if ((guid != NULL) && (book != NULL)) { \
const QofCollection *col; \ const QofCollection *col; \
col = qof_book_get_collection (book, e_type); \ col = qof_book_get_collection (book, e_type); \
val = qof_collection_lookup_entity (col, guid); \ val = qof_collection_lookup_entity (col, guid); \
@ -191,7 +192,7 @@ GType qof_book_get_type(void);
/** GList of QofBook */ /** GList of QofBook */
typedef GList QofBookList; typedef GList QofBookList;
typedef void (*QofBookFinalCB) (QofBook *, gpointer key, gpointer user_data); typedef void (*QofBookFinalCB) (QofBook *, gpointer key, gpointer user_data);
@ -204,7 +205,7 @@ QofBook * qof_book_new (void);
/** End any editing sessions associated with book, and free all memory /** End any editing sessions associated with book, and free all memory
associated with it. */ associated with it. */
void qof_book_destroy (QofBook *book); void qof_book_destroy (QofBook *book);
/** Close a book to editing. /** Close a book to editing.
@ -390,7 +391,7 @@ void qof_book_commit_edit(QofBook *book);
* @param odb: The GNCOptionDB to load. * @param odb: The GNCOptionDB to load.
*/ */
void qof_book_load_options (QofBook *book, GNCOptionLoad load_cb, void qof_book_load_options (QofBook *book, GNCOptionLoad load_cb,
GNCOptionDB *odb); GNCOptionDB *odb);
/** Save a GNCOptionsDB back to the book's KVP. /** Save a GNCOptionsDB back to the book's KVP.
* @param book: The book. * @param book: The book.
* @param save_cb: A callback function that does the saving. * @param save_cb: A callback function that does the saving.