GnuCash  2.6.99
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
AccountP.h
Go to the documentation of this file.
1 /********************************************************************\
2  * AccountP.h -- Account engine-private data structure *
3  * Copyright (C) 1997 Robin D. Clark *
4  * Copyright (C) 1997-2002, Linas Vepstas <[email protected]> *
5  * *
6  * This program is free software; you can redistribute it and/or *
7  * modify it under the terms of the GNU General Public License as *
8  * published by the Free Software Foundation; either version 2 of *
9  * the License, or (at your option) any later version. *
10  * *
11  * This program is distributed in the hope that it will be useful, *
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14  * GNU General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU General Public License*
17  * along with this program; if not, contact: *
18  * *
19  * Free Software Foundation Voice: +1-617-542-5942 *
20  * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
21  * Boston, MA 02110-1301, USA [email protected] *
22  * *
23 \********************************************************************/
24 
39 #ifndef XACC_ACCOUNT_P_H
40 #define XACC_ACCOUNT_P_H
41 
42 #include "Account.h"
43 
44 #define GNC_ID_ROOT_ACCOUNT "RootAccount"
45 
55 typedef struct AccountPrivate
56 {
57  /* The accountName is an arbitrary string assigned by the user.
58  * It is intended to a short, 5 to 30 character long string that
59  * is displayed by the GUI as the account mnemonic.
60  */
61  char *accountName;
62 
63  /* The accountCode is an arbitrary string assigned by the user.
64  * It is intended to be reporting code that is a synonym for the
65  * accountName. Typically, it will be a numeric value that follows
66  * the numbering assignments commonly used by accountants, such
67  * as 100, 200 or 600 for top-level accounts, and 101, 102.. etc.
68  * for detail accounts.
69  */
70  char *accountCode;
71 
72  /* The description is an arbitrary string assigned by the user.
73  * It is intended to be a longer, 1-5 sentence description of what
74  * this account is all about.
75  */
76  char *description;
77 
78  /* The type field is the account type, picked from the enumerated
79  * list that includes ACCT_TYPE_BANK, ACCT_TYPE_STOCK,
80  * ACCT_TYPE_CREDIT, ACCT_TYPE_INCOME, etc. Its intended use is to
81  * be a hint to the GUI as to how to display and format the
82  * transaction data.
83  */
84  GNCAccountType type;
85 
86  /*
87  * The commodity field denotes the kind of 'stuff' stored
88  * in this account. The 'amount' field of a split indicates
89  * how much of the 'stuff' there is.
90  */
91  gnc_commodity * commodity;
92  int commodity_scu;
93  gboolean non_standard_scu;
94 
95  /* The parent and children pointers are used to implement an account
96  * hierarchy, of accounts that have sub-accounts ("detail accounts").
97  */
98  Account *parent; /* back-pointer to parent */
99  GList *children; /* list of sub-accounts */
100 
101  /* protected data - should only be set by backends */
102  gnc_numeric starting_balance;
103  gnc_numeric starting_cleared_balance;
104  gnc_numeric starting_reconciled_balance;
105 
106  /* cached parameters */
107  gnc_numeric balance;
108  gnc_numeric cleared_balance;
109  gnc_numeric reconciled_balance;
110 
111  gboolean balance_dirty; /* balances in splits incorrect */
112 
113  GList *splits; /* list of split pointers */
114  gboolean sort_dirty; /* sort order of splits is bad */
115 
116  LotList *lots; /* list of lot pointers */
117  GNCPolicy *policy; /* Cached pointer to policy method */
118 
119  /* The "mark" flag can be used by the user to mark this account
120  * in any way desired. Handy for specialty traversals of the
121  * account tree. */
122  short mark;
124 
125 struct account_s
126 {
127  QofInstance inst;
128 };
129 
130 /* Set the account's GncGUID. This should only be done when reading
131  * an account from a datafile, or some other external source. Never
132  * call this on an existing account! */
133 void xaccAccountSetGUID (Account *account, const GncGUID *guid);
134 
135 /* Register Accounts with the engine */
136 gboolean xaccAccountRegister (void);
137 
138 /* Structure for accessing static functions for testing */
139 typedef struct
140 {
141  AccountPrivate *(*get_private) (Account *acc);
142  Account *(*coll_get_root_account) (QofCollection *col);
143  void (*xaccFreeAccountChildren) (Account *acc);
144  void (*xaccFreeAccount) (Account *acc);
145  void (*qofAccountSetParent) (Account *acc, QofInstance *parent);
146  Account *(*gnc_account_lookup_by_full_name_helper) (const Account *acc,
147  gchar **names);
149 
150 AccountTestFunctions* _utest_account_fill_functions(void);
151 
152 
153 #endif /* XACC_ACCOUNT_P_H */
GList LotList
Definition: gnc-engine.h:201
Definition: guid.h:65
Account handling public routines.
GNCAccountType
Definition: Account.h:96