1 /********************************************************************\
2  * SX-book.h -- scheduled transaction dataset access                *
3  *                                                                  *
4  * This program is free software; you can redistribute it and/or    *
5  * modify it under the terms of the GNU General Public License as   *
6  * published by the Free Software Foundation; either version 2 of   *
7  * the License, or (at your option) any later version.              *
8  *                                                                  *
9  * This program is distributed in the hope that it will be useful,  *
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of   *
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    *
12  * GNU General Public License for more details.                     *
13  *                                                                  *
14  * You should have received a copy of the GNU General Public License*
15  * along with this program; if not, contact:                        *
16  *                                                                  *
17  * Free Software Foundation           Voice:  +1-617-542-5942       *
18  * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652       *
19  * Boston, MA  02110-1301,  USA       gnu@gnu.org                   *
20 \********************************************************************/
21 
22 /**
23  * @addtogroup Engine
24  * @{ */
25 /**
26  * @addtogroup SchedXaction
27  * @{ */
28 /**
29  * @file SX-book.h
30  * @brief Anchor Scheduled Transaction info in a book.
31  *        See src/doc/books.txt for design overview.
32  * @author Copyright (c) 2003 Linas Vepstas <linas@linas.org>
33  * @author Copyright (c) 2006 Joshua Sled <jsled@asynchronous.org>
34  *
35  * XXX currently, this is crufty, it should be modified to use
36  * entities a bit more whole-heartedly than it does.
37  **/
38 
39 #ifndef GNC_SX_BOOK_H
40 #define GNC_SX_BOOK_H
41 
42 typedef struct xaccSchedXactionsDef SchedXactions;
43 typedef struct _SchedXactionsClass SchedXactionsClass;
44 
45 #ifdef __cplusplus
46 extern "C++" {
47 #include <glib.h>
48 }
49 #endif
50 #include "SchedXaction.h"
51 #include "qof.h"
52 
53 struct xaccSchedXactionsDef
54 {
55     QofInstance inst;
56     GList* sx_list;
57     gboolean sx_notsaved;
58 };
59 
60 struct _SchedXactionsClass
61 {
62     QofInstanceClass parent_class;
63 };
64 
65 /* --- type macros --- */
66 #define GNC_TYPE_SCHEDXACTIONS            (gnc_schedxactions_get_type ())
67 #define GNC_SCHEDXACTIONS(o)              \
68      (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_SCHEDXACTIONS, SchedXactions))
69 #define GNC_SCHEDXACTIONS_CLASS(k)        \
70      (G_TYPE_CHECK_CLASS_CAST((k), GNC_TYPE_SCHEDXACTIONS, SchedXactionsClass))
71 #define GNC_IS_SCHEDXACTIONS(o)           \
72      (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_SCHEDXACTIONS))
73 #define GNC_IS_SCHEDXACTIONS_CLASS(k)     \
74      (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_SCHEDXACTIONS))
75 #define GNC_SCHEDXACTIONS_GET_CLASS(o)    \
76      (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_SCHEDXACTIONS, SchedXactionsClass))
77 GType gnc_schedxactions_get_type(void);
78 
79 #define GNC_IS_SXES(obj)  GNC_IS_SCHEDXACTIONS(obj)
80 #define GNC_SXES(obj)     GNC_SCHEDXACTIONS(obj)
81 
82 /*@ dependent @*/ SchedXactions* gnc_book_get_schedxactions(QofBook* book);
83 
84 void gnc_sxes_add_sx(SchedXactions* sxes, SchedXaction* sx);
85 void gnc_sxes_del_sx(SchedXactions* sxes, SchedXaction* sx);
86 
87 /** Returns the template group from the book. **/
88 /*@ dependent @*/
89 Account *gnc_book_get_template_root(const QofBook *book);
90 
91 /** @return The list of SXes which reference the given Account. Caller should free this list. **/
92 GList* gnc_sx_get_sxes_referencing_account(QofBook *book, Account *acct);
93 
94 #endif /* GNC_SX_BOOK_H */
95 /** @} */
96 /** @} */
97