mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
implement data hiding for account structures
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@674 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
ae0ac46d64
commit
e1cd45c458
@ -26,6 +26,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "Account.h"
|
||||
#include "AccountP.h"
|
||||
#include "Group.h"
|
||||
#include "date.h"
|
||||
#include "messages.h"
|
||||
|
@ -51,36 +51,6 @@ enum {
|
||||
* the enumerated types above */
|
||||
extern char *account_type_name[];
|
||||
|
||||
/** STRUCTS *********************************************************/
|
||||
typedef struct _Account {
|
||||
/* public data, describes account */
|
||||
|
||||
struct _account_group *parent; /* back-pointer to parent */
|
||||
struct _account_group *children; /* pointer to sub-accounts */
|
||||
int id; /* unique account id, internally assigned */
|
||||
char flags;
|
||||
short type;
|
||||
char *accountName;
|
||||
char *description;
|
||||
char *notes;
|
||||
|
||||
/* protected data, cached parameters */
|
||||
double balance;
|
||||
double cleared_balance;
|
||||
double reconciled_balance;
|
||||
|
||||
double running_balance;
|
||||
double running_cleared_balance;
|
||||
double running_reconciled_balance;
|
||||
|
||||
int numSplits; /* length of splits array below */
|
||||
Split **splits; /* ptr to array of ptrs to splits */
|
||||
|
||||
/* the modified flag helps the gui keep track of
|
||||
* changes to this account */
|
||||
short changed;
|
||||
} Account;
|
||||
|
||||
/** PROTOTYPES ******************************************************/
|
||||
|
||||
Account *xaccMallocAccount( void );
|
||||
@ -137,8 +107,6 @@ void xaccConsolidateTransactions (Account *);
|
||||
void xaccMoveFarEnd (Split *, Account *);
|
||||
void xaccMoveFarEndByName (Split *, const char *);
|
||||
|
||||
Account * xaccSplitGetAccount (Split *);
|
||||
|
||||
/** GLOBALS *********************************************************/
|
||||
|
||||
extern int next_free_unique_account_id;
|
||||
|
73
src/engine/AccountP.h
Normal file
73
src/engine/AccountP.h
Normal file
@ -0,0 +1,73 @@
|
||||
/*
|
||||
* FILE:
|
||||
* AccountP.h
|
||||
*
|
||||
* FUNCTION:
|
||||
* This is the *private* header for the account structure.
|
||||
* No one outside of the engine should ever include this file.
|
||||
*
|
||||
*/
|
||||
|
||||
/********************************************************************\
|
||||
* Account.h -- the Account data structure *
|
||||
* Copyright (C) 1997 Robin D. Clark *
|
||||
* Copyright (C) 1997, 1998 Linas Vepstas *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
* published by the Free Software Foundation; either version 2 of *
|
||||
* the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License*
|
||||
* along with this program; if not, write to the Free Software *
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||
* *
|
||||
* Author: Rob Clark *
|
||||
* Internet: rclark@cs.hmc.edu *
|
||||
* Address: 609 8th Street *
|
||||
* Huntington Beach, CA 92648-4632 *
|
||||
\********************************************************************/
|
||||
|
||||
#ifndef __XACC_ACCOUNT_P_H__
|
||||
#define __XACC_ACCOUNT_P_H__
|
||||
|
||||
#include "config.h"
|
||||
#include "Transaction.h"
|
||||
|
||||
/** STRUCTS *********************************************************/
|
||||
struct _account {
|
||||
/* public data, describes account */
|
||||
|
||||
struct _account_group *parent; /* back-pointer to parent */
|
||||
struct _account_group *children; /* pointer to sub-accounts */
|
||||
int id; /* unique account id, internally assigned */
|
||||
char flags;
|
||||
short type;
|
||||
char *accountName;
|
||||
char *description;
|
||||
char *notes;
|
||||
|
||||
/* protected data, cached parameters */
|
||||
double balance;
|
||||
double cleared_balance;
|
||||
double reconciled_balance;
|
||||
|
||||
double running_balance;
|
||||
double running_cleared_balance;
|
||||
double running_reconciled_balance;
|
||||
|
||||
int numSplits; /* length of splits array below */
|
||||
Split **splits; /* ptr to array of ptrs to splits */
|
||||
|
||||
/* the modified flag helps the gui keep track of
|
||||
* changes to this account */
|
||||
short changed;
|
||||
};
|
||||
|
||||
|
||||
#endif /* __XACC_ACCOUNT_P_H__ */
|
@ -84,6 +84,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "Account.h"
|
||||
#include "AccountP.h"
|
||||
#include "FileIO.h"
|
||||
#include "Group.h"
|
||||
#include "messages.h"
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "Account.h"
|
||||
#include "AccountP.h"
|
||||
#include "Group.h"
|
||||
#include "TransactionP.h"
|
||||
#include "util.h"
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "Account.h"
|
||||
#include "AccountP.h"
|
||||
#include "Group.h"
|
||||
#include "Transaction.h"
|
||||
#include "util.h"
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "Account.h"
|
||||
#include "AccountP.h"
|
||||
#include "Group.h"
|
||||
#include "FileIO.h"
|
||||
#include "TransactionP.h"
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "Account.h"
|
||||
#include "AccountP.h"
|
||||
#include "date.h"
|
||||
#include "Transaction.h"
|
||||
#include "TransactionP.h"
|
||||
|
@ -48,6 +48,7 @@
|
||||
* between "dining", "tips" and "taxes" categories.
|
||||
*/
|
||||
|
||||
typedef struct _account Account;
|
||||
typedef struct _split Split;
|
||||
typedef struct _transaction Transaction;
|
||||
|
||||
@ -148,6 +149,8 @@ double xaccSplitGetAmount (Split * split);
|
||||
double xaccSplitGetValue (Split * split);
|
||||
double xaccSplitGetSharePrice (Split * split);
|
||||
|
||||
Account * xaccSplitGetAccount (Split *);
|
||||
|
||||
/********************************************************************\
|
||||
* sorting comparison function
|
||||
*
|
||||
|
@ -57,8 +57,8 @@
|
||||
*/
|
||||
|
||||
struct _split {
|
||||
struct _account *acc; /* back-pointer to debited/credited account */
|
||||
struct _transaction *parent; /* parent of split */
|
||||
Account *acc; /* back-pointer to debited/credited account */
|
||||
Transaction *parent; /* parent of split */
|
||||
char * memo;
|
||||
char * action; /* Buy, Sell, Div, etc. */
|
||||
char reconciled;
|
||||
|
Loading…
Reference in New Issue
Block a user