Add some const declarations.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15857 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
David Hampton 2007-04-09 23:28:09 +00:00
parent 13d841930b
commit 4a8089b4c5
6 changed files with 59 additions and 59 deletions

View File

@ -239,7 +239,7 @@ gnc_sx_commit_edit (SchedXaction *sx)
/* ============================================================ */
FreqSpec *
xaccSchedXactionGetFreqSpec( SchedXaction *sx )
xaccSchedXactionGetFreqSpec( const SchedXaction *sx )
{
return sx->freq;
}
@ -257,7 +257,7 @@ xaccSchedXactionSetFreqSpec( SchedXaction *sx, FreqSpec *fs )
}
GList*
gnc_sx_get_schedule(SchedXaction *sx)
gnc_sx_get_schedule(const SchedXaction *sx)
{
return sx->schedule;
}
@ -273,7 +273,7 @@ gnc_sx_set_schedule(SchedXaction *sx, GList *schedule)
}
gchar *
xaccSchedXactionGetName( SchedXaction *sx )
xaccSchedXactionGetName( const SchedXaction *sx )
{
return sx->name;
}
@ -308,7 +308,7 @@ xaccSchedXactionSetStartDate( SchedXaction *sx, GDate* newStart )
}
gboolean
xaccSchedXactionHasEndDate( SchedXaction *sx )
xaccSchedXactionHasEndDate( const SchedXaction *sx )
{
return g_date_valid( &sx->end_date );
}
@ -355,13 +355,13 @@ xaccSchedXactionSetLastOccurDate( SchedXaction *sx, GDate* newLastOccur )
}
gboolean
xaccSchedXactionHasOccurDef( SchedXaction *sx )
xaccSchedXactionHasOccurDef( const SchedXaction *sx )
{
return ( xaccSchedXactionGetNumOccur( sx ) != 0 );
}
gint
xaccSchedXactionGetNumOccur( SchedXaction *sx )
xaccSchedXactionGetNumOccur( const SchedXaction *sx )
{
return sx->num_occurances_total;
}
@ -376,7 +376,7 @@ xaccSchedXactionSetNumOccur( SchedXaction *sx, gint newNum )
}
gint
xaccSchedXactionGetRemOccur( SchedXaction *sx )
xaccSchedXactionGetRemOccur( const SchedXaction *sx )
{
return sx->num_occurances_remain;
}
@ -401,7 +401,7 @@ xaccSchedXactionSetRemOccur( SchedXaction *sx,
KvpValue *
xaccSchedXactionGetSlot( SchedXaction *sx, const char *slot )
xaccSchedXactionGetSlot( const SchedXaction *sx, const char *slot )
{
if (!sx) return NULL;
@ -422,7 +422,7 @@ xaccSchedXactionSetSlot( SchedXaction *sx,
}
gboolean
xaccSchedXactionGetEnabled( SchedXaction *sx )
xaccSchedXactionGetEnabled( const SchedXaction *sx )
{
return sx->enabled;
}
@ -437,7 +437,7 @@ xaccSchedXactionSetEnabled( SchedXaction *sx, gboolean newEnabled)
}
void
xaccSchedXactionGetAutoCreate( SchedXaction *sx,
xaccSchedXactionGetAutoCreate( const SchedXaction *sx,
gboolean *outAutoCreate,
gboolean *outNotify )
{
@ -463,7 +463,7 @@ xaccSchedXactionSetAutoCreate( SchedXaction *sx,
}
gint
xaccSchedXactionGetAdvanceCreation( SchedXaction *sx )
xaccSchedXactionGetAdvanceCreation( const SchedXaction *sx )
{
return sx->advanceCreateDays;
}
@ -478,7 +478,7 @@ xaccSchedXactionSetAdvanceCreation( SchedXaction *sx, gint createDays )
}
gint
xaccSchedXactionGetAdvanceReminder( SchedXaction *sx )
xaccSchedXactionGetAdvanceReminder( const SchedXaction *sx )
{
return sx->advanceRemindDays;
}
@ -604,7 +604,7 @@ xaccSchedXactionGetInstanceAfter( SchedXaction *sx,
}
gint
gnc_sx_get_instance_count( SchedXaction *sx, void *stateData )
gnc_sx_get_instance_count( const SchedXaction *sx, void *stateData )
{
gint toRet = -1;
temporalStateData *tsd;
@ -627,7 +627,7 @@ gnc_sx_set_instance_count( SchedXaction *sx, gint instanceNum )
}
GList *
xaccSchedXactionGetSplits( SchedXaction *sx )
xaccSchedXactionGetSplits( const SchedXaction *sx )
{
g_return_val_if_fail( sx, NULL );
return xaccAccountGetSplitList(sx->template_acct);

View File

@ -150,18 +150,18 @@ void gnc_sx_begin_edit (SchedXaction *sx);
void gnc_sx_commit_edit (SchedXaction *sx);
/** @return GList<Recurrence*> **/
GList* gnc_sx_get_schedule(SchedXaction *sx);
GList* gnc_sx_get_schedule(const SchedXaction *sx);
/** @param[in] schedule A GList<Recurrence*> **/
void gnc_sx_set_schedule(SchedXaction *sx, GList *schedule);
FreqSpec *xaccSchedXactionGetFreqSpec( SchedXaction *sx );
FreqSpec *xaccSchedXactionGetFreqSpec( const SchedXaction *sx );
/**
* The FreqSpec is given to the SchedXaction for mem mgmt; it should
* not be freed by the external code.
*/
void xaccSchedXactionSetFreqSpec( SchedXaction *sx, FreqSpec *fs );
gchar *xaccSchedXactionGetName( SchedXaction *sx );
gchar *xaccSchedXactionGetName( const SchedXaction *sx );
/**
* A copy of the name is made.
*/
@ -170,7 +170,7 @@ void xaccSchedXactionSetName( SchedXaction *sx, const gchar *newName );
GDate* xaccSchedXactionGetStartDate( SchedXaction *sx );
void xaccSchedXactionSetStartDate( SchedXaction *sx, GDate* newStart );
int xaccSchedXactionHasEndDate( SchedXaction *sx );
int xaccSchedXactionHasEndDate( const SchedXaction *sx );
/**
* Returns invalid date when there is no end-date specified.
*/
@ -187,13 +187,13 @@ void xaccSchedXactionSetLastOccurDate( SchedXaction *sx, GDate* newLastOccur );
* Returns true if the scheduled transaction has a defined number of
* occurances, false if not.
*/
gboolean xaccSchedXactionHasOccurDef( SchedXaction *sx );
gint xaccSchedXactionGetNumOccur( SchedXaction *sx );
gboolean xaccSchedXactionHasOccurDef( const SchedXaction *sx );
gint xaccSchedXactionGetNumOccur( const SchedXaction *sx );
/**
* Set to '0' to turn off number-of-occurances definition.
*/
void xaccSchedXactionSetNumOccur( SchedXaction *sx, gint numNum );
gint xaccSchedXactionGetRemOccur( SchedXaction *sx );
gint xaccSchedXactionGetRemOccur( const SchedXaction *sx );
void xaccSchedXactionSetRemOccur( SchedXaction *sx, gint numRemain );
/** \brief Set the instance count.
@ -205,30 +205,30 @@ void xaccSchedXactionSetRemOccur( SchedXaction *sx, gint numRemain );
* @param sx The instance whose state should be retrieved.
* @param stateData may be NULL.
*/
gint gnc_sx_get_instance_count( SchedXaction *sx, void *stateData );
gint gnc_sx_get_instance_count( const SchedXaction *sx, void *stateData );
/**
* Sets the instance count to something other than the default. As the
* default is the incorrect value '0', callers should DTRT here.
*/
void gnc_sx_set_instance_count( SchedXaction *sx, gint instanceNum );
GList *xaccSchedXactionGetSplits( SchedXaction *sx );
GList *xaccSchedXactionGetSplits( const SchedXaction *sx );
void xaccSchedXactionSetSplits( SchedXaction *sx, GList *newSplits );
gboolean xaccSchedXactionGetEnabled( SchedXaction *sx );
gboolean xaccSchedXactionGetEnabled( const SchedXaction *sx );
void xaccSchedXactionSetEnabled( SchedXaction *sx, gboolean newEnabled );
void xaccSchedXactionGetAutoCreate( SchedXaction *sx,
void xaccSchedXactionGetAutoCreate( const SchedXaction *sx,
gboolean *outAutoCreate,
gboolean *outNotify );
void xaccSchedXactionSetAutoCreate( SchedXaction *sx,
gboolean newAutoCreate,
gboolean newNotify );
gint xaccSchedXactionGetAdvanceCreation( SchedXaction *sx );
gint xaccSchedXactionGetAdvanceCreation( const SchedXaction *sx );
void xaccSchedXactionSetAdvanceCreation( SchedXaction *sx, gint createDays );
gint xaccSchedXactionGetAdvanceReminder( SchedXaction *sx );
gint xaccSchedXactionGetAdvanceReminder( const SchedXaction *sx );
void xaccSchedXactionSetAdvanceReminder( SchedXaction *sx, gint reminderDays );
/** \name Temporal state data.
@ -323,7 +323,7 @@ gboolean SXRegister (void);
#define xaccSchedXactionGetSlots(X) qof_instance_get_slots(QOF_INSTANCE(X))
/** \deprecated to be replaced with 'dirty' kvp's */
KvpValue *xaccSchedXactionGetSlot( SchedXaction *sx,
KvpValue *xaccSchedXactionGetSlot( const SchedXaction *sx,
const char *slot );
/** \deprecated to be replaced with 'dirty' kvp's */
void xaccSchedXactionSetSlot( SchedXaction *sx,

View File

@ -168,26 +168,26 @@ gnc_lot_is_closed (GNCLot *lot)
}
Account *
gnc_lot_get_account (GNCLot *lot)
gnc_lot_get_account (const GNCLot *lot)
{
if (!lot) return NULL;
return lot->account;
}
KvpFrame *
gnc_lot_get_slots (GNCLot *lot)
gnc_lot_get_slots (const GNCLot *lot)
{
return qof_instance_get_slots(QOF_INSTANCE(lot));
}
SplitList *
gnc_lot_get_split_list (GNCLot *lot)
gnc_lot_get_split_list (const GNCLot *lot)
{
if (!lot) return NULL;
return lot->splits;
}
gint gnc_lot_count_splits (GNCLot *lot)
gint gnc_lot_count_splits (const GNCLot *lot)
{
if (!lot) return 0;
return g_list_length (lot->splits);
@ -197,14 +197,14 @@ gint gnc_lot_count_splits (GNCLot *lot)
/* Hmm, we should probably inline these. */
const char *
gnc_lot_get_title (GNCLot *lot)
gnc_lot_get_title (const GNCLot *lot)
{
if (!lot) return NULL;
return kvp_frame_get_string (lot->inst.kvp_data, "/title");
}
const char *
gnc_lot_get_notes (GNCLot *lot)
gnc_lot_get_notes (const GNCLot *lot)
{
if (!lot) return NULL;
return kvp_frame_get_string (lot->inst.kvp_data, "/notes");
@ -272,7 +272,7 @@ gnc_lot_get_balance (GNCLot *lot)
/* ============================================================= */
void
gnc_lot_get_balance_before (GNCLot *lot, Split *split,
gnc_lot_get_balance_before (const GNCLot *lot, const Split *split,
gnc_numeric *amount, gnc_numeric *value)
{
GList *node;
@ -283,7 +283,7 @@ gnc_lot_get_balance_before (GNCLot *lot, Split *split,
if (lot && lot->splits)
{
Transaction *ta, *tb;
Split *target;
const Split *target;
/* If this is a gains split, find the source of the gains and use
its transaction for the comparison. Gains splits are in separate
transactions that may sort after non-gains transactions. */

View File

@ -105,12 +105,12 @@ void gnc_lot_remove_split (GNCLot *, Split *);
* either gnc_lot_add_split() or gnc_lot_remove_split() will
* invalidate the returned pointer.
*/
SplitList * gnc_lot_get_split_list (GNCLot *);
gint gnc_lot_count_splits (GNCLot *);
SplitList * gnc_lot_get_split_list (const GNCLot *);
gint gnc_lot_count_splits (const GNCLot *);
/** The gnc_lot_get_account() routine returns the account with which
* this lot is associated. */
Account * gnc_lot_get_account (GNCLot *);
Account * gnc_lot_get_account (const GNCLot *);
/** The gnc_lot_get_balance() routine returns the balance of the lot.
* The commodity in which this balance is expressed is the commodity
@ -121,7 +121,7 @@ gnc_numeric gnc_lot_get_balance (GNCLot *);
* value in the lot considering only splits in transactions prior to the
* one containing the given split or other splits in the same transaction.
* The first return value is the amount and the second is the value. */
void gnc_lot_get_balance_before (GNCLot *, Split *,
void gnc_lot_get_balance_before (const GNCLot *, const Split *,
gnc_numeric *, gnc_numeric *);
/** The gnc_lot_is_closed() routine returns a boolean flag: is this
@ -146,15 +146,15 @@ Split * gnc_lot_get_earliest_split (GNCLot *lot);
Split * gnc_lot_get_latest_split (GNCLot *lot);
/** Get and set the account title, or the account notes. */
const char * gnc_lot_get_title (GNCLot *);
const char * gnc_lot_get_notes (GNCLot *);
const char * gnc_lot_get_title (const GNCLot *);
const char * gnc_lot_get_notes (const GNCLot *);
void gnc_lot_set_title (GNCLot *, const char *);
void gnc_lot_set_notes (GNCLot *, const char *);
/** Every lot has a place to hang kvp data. This routine returns that
* place.
* */
KvpFrame * gnc_lot_get_slots (GNCLot *);
KvpFrame * gnc_lot_get_slots (const GNCLot *);
#define gnc_lot_get_guid(X) qof_instance_get_guid(QOF_INSTANCE(X))

View File

@ -330,14 +330,14 @@ gnc_price_lookup (const GUID *guid, QofBook *book)
}
gnc_commodity *
gnc_price_get_commodity(GNCPrice *p)
gnc_price_get_commodity(const GNCPrice *p)
{
if(!p) return NULL;
return p->commodity;
}
Timespec
gnc_price_get_time(GNCPrice *p)
gnc_price_get_time(const GNCPrice *p)
{
if(!p) {
Timespec result;
@ -349,21 +349,21 @@ gnc_price_get_time(GNCPrice *p)
}
const char *
gnc_price_get_source(GNCPrice *p)
gnc_price_get_source(const GNCPrice *p)
{
if(!p) return NULL;
return p->source;
}
const char *
gnc_price_get_typestr(GNCPrice *p)
gnc_price_get_typestr(const GNCPrice *p)
{
if(!p) return NULL;
return p->type;
}
gnc_numeric
gnc_price_get_value(GNCPrice *p)
gnc_price_get_value(const GNCPrice *p)
{
if(!p) {
PERR("price NULL.\n");
@ -373,21 +373,21 @@ gnc_price_get_value(GNCPrice *p)
}
gnc_commodity *
gnc_price_get_currency(GNCPrice *p)
gnc_price_get_currency(const GNCPrice *p)
{
if(!p) return NULL;
return p->currency;
}
gint32
gnc_price_get_version(GNCPrice *p)
gnc_price_get_version(const GNCPrice *p)
{
if(!p) return 0;
return (p->version);
}
gboolean
gnc_price_equal (GNCPrice *p1, GNCPrice *p2)
gnc_price_equal (const GNCPrice *p1, const GNCPrice *p2)
{
Timespec ts1;
Timespec ts2;

View File

@ -220,14 +220,14 @@ void gnc_price_set_version(GNCPrice *p, gint32 versn);
/** As mentioned above all of the getters return data that's internal
to the GNCPrice, not copies, so don't free these values. */
GNCPrice * gnc_price_lookup (const GUID *guid, QofBook *book);
gnc_commodity * gnc_price_get_commodity(GNCPrice *p);
gnc_commodity * gnc_price_get_currency(GNCPrice *p);
Timespec gnc_price_get_time(GNCPrice *p);
const char * gnc_price_get_source(GNCPrice *p);
const char * gnc_price_get_typestr(GNCPrice *p);
gnc_numeric gnc_price_get_value(GNCPrice *p);
gint32 gnc_price_get_version(GNCPrice *p);
gboolean gnc_price_equal(GNCPrice *p1, GNCPrice *p2);
gnc_commodity * gnc_price_get_commodity(const GNCPrice *p);
gnc_commodity * gnc_price_get_currency(const GNCPrice *p);
Timespec gnc_price_get_time(const GNCPrice *p);
const char * gnc_price_get_source(const GNCPrice *p);
const char * gnc_price_get_typestr(const GNCPrice *p);
gnc_numeric gnc_price_get_value(const GNCPrice *p);
gint32 gnc_price_get_version(const GNCPrice *p);
gboolean gnc_price_equal(const GNCPrice *p1, const GNCPrice *p2);
#define gnc_price_get_guid(X) qof_instance_get_guid(QOF_INSTANCE(X))
#define gnc_price_return_guid(X) (*(qof_instance_get_guid(QOF_INSTANCE(X))))