LibOFX: ofx_containers.hh Source File

LibOFX

ofx_containers.hh
Go to the documentation of this file.
1 /***************************************************************************
2 ofx_proc_rs.h
3 -------------------
4 copyright : (C) 2002 by Benoit Gr�goire
5 email : benoitg@coeus.ca
6 ***************************************************************************/
13 /***************************************************************************
14 * *
15 * This program is free software; you can redistribute it and/or modify *
16 * it under the terms of the GNU General Public License as published by *
17 * the Free Software Foundation; either version 2 of the License, or *
18 * (at your option) any later version. *
19 * *
20 ***************************************************************************/
21 #ifndef OFX_PROC_H
22 #define OFX_PROC_H
23 #include "libofx.h"
24 #include "tree.hh"
25 #include "context.hh"
26
27 using namespace std;
28
33 class OfxGenericContainer
34 {
35 public:
36 string type;
37 string tag_identifier;
38 OfxGenericContainer *parentcontainer;
39 LibofxContext *libofx_context;
40
41 OfxGenericContainer(LibofxContext *p_libofx_context);
42 OfxGenericContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer);
43 OfxGenericContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, string para_tag_identifier);
44
45 virtual ~OfxGenericContainer() {};
46
53 virtual void add_attribute(const string identifier, const string value);
59 virtual int gen_event();
60
66 virtual int add_to_main_tree();
67
69 OfxGenericContainer* getparent();
70 };//End class OfxGenericObject
71
76 class OfxDummyContainer: public OfxGenericContainer
77 {
78 public:
79 OfxDummyContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, string para_tag_identifier);
80 void add_attribute(const string identifier, const string value);
81 };
82
87 class OfxPushUpContainer: public OfxGenericContainer
88 {
89 public:
90
91 OfxPushUpContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, string para_tag_identifier);
92 void add_attribute(const string identifier, const string value);
93 };
94
96 class OfxStatusContainer: public OfxGenericContainer
97 {
98 public:
99 OfxStatusData data;
100
101 OfxStatusContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, string para_tag_identifier);
102 ~OfxStatusContainer();
103 void add_attribute(const string identifier, const string value);
104 };
105
110 class OfxBalanceContainer: public OfxGenericContainer
111 {
112 public:
113 /* Not yet complete see spec 1.6 p.63 */
114 //char name[OFX_BALANCE_NAME_LENGTH];
115 //char description[OFX_BALANCE_DESCRIPTION_LENGTH];
116 //enum BalanceType{DOLLAR, PERCENT, NUMBER} balance_type;
117 double amount;
118 int amount_valid;
119 time_t date;
120 int date_valid;
121
122 OfxBalanceContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, string para_tag_identifier);
123 ~OfxBalanceContainer();
124 void add_attribute(const string identifier, const string value);
125 };
126
127 /***************************************************************************
128 * OfxStatementContainer *
129 ***************************************************************************/
134 class OfxStatementContainer: public OfxGenericContainer
135 {
136 public:
137 OfxStatementData data;
138
139 OfxStatementContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, string para_tag_identifier);
140 ~OfxStatementContainer();
141 void add_attribute(const string identifier, const string value);
142 virtual int add_to_main_tree();
143 virtual int gen_event();
144 void add_account(OfxAccountData * account_data);
145 void add_balance(OfxBalanceContainer* ptr_balance_container);
146 // void add_transaction(const OfxTransactionData transaction_data);
147
148 };
149
150 /***************************************************************************
151 * OfxAccountContaine r *
152 ***************************************************************************/
157 class OfxAccountContainer: public OfxGenericContainer
158 {
159 public:
160 OfxAccountData data;
161
162 OfxAccountContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, string para_tag_identifier);
163 ~OfxAccountContainer();
164 void add_attribute(const string identifier, const string value);
165 int add_to_main_tree();
166 virtual int gen_event();
167 private:
168 void gen_account_id(void);
169 char bankid[OFX_BANKID_LENGTH];
170 char branchid[OFX_BRANCHID_LENGTH];
171 char acctid[OFX_ACCTID_LENGTH];
172 char acctkey[OFX_ACCTKEY_LENGTH];
173 char brokerid[OFX_BROKERID_LENGTH];
174 };
175
176 /***************************************************************************
177 * OfxSecurityContainer *
178 ***************************************************************************/
181 class OfxSecurityContainer: public OfxGenericContainer
182 {
183 public:
184 OfxSecurityData data;
185
186 OfxSecurityContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, string para_tag_identifier);
187 ~OfxSecurityContainer();
188 void add_attribute(const string identifier, const string value);
189 virtual int gen_event();
190 virtual int add_to_main_tree();
191 private:
192 OfxStatementContainer * parent_statement;
193 };
194
195
196 /***************************************************************************
197 * OfxTransactionContainer *
198 ***************************************************************************/
201 class OfxTransactionContainer: public OfxGenericContainer
202 {
203 public:
204 OfxTransactionData data;
205
206 OfxTransactionContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, string para_tag_identifier);
207 ~OfxTransactionContainer();
208 virtual void add_attribute(const string identifier, const string value);
209 void add_account(OfxAccountData * account_data);
210
211 virtual int gen_event();
212 virtual int add_to_main_tree();
213 private:
214 OfxStatementContainer * parent_statement;
215 };
216
221 class OfxBankTransactionContainer: public OfxTransactionContainer
222 {
223 public:
224 OfxBankTransactionContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, string para_tag_identifier);
225 void add_attribute(const string identifier, const string value);
226 };
227
232 class OfxInvestmentTransactionContainer: public OfxTransactionContainer
233 {
234 public:
235 OfxInvestmentTransactionContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, string para_tag_identifier);
236
237 void add_attribute(const string identifier, const string value);
238 };
239
240 /***************************************************************************
241 * OfxMainContainer *
242 ***************************************************************************/
247 class OfxMainContainer: public OfxGenericContainer
248 {
249 public:
250 OfxMainContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, string para_tag_identifier);
251 ~OfxMainContainer();
252 int add_container(OfxGenericContainer * container);
253 int add_container(OfxStatementContainer * container);
254 int add_container(OfxAccountContainer * container);
255 int add_container(OfxTransactionContainer * container);
256 int add_container(OfxSecurityContainer * container);
257 int gen_event();
258 OfxSecurityData * find_security(string unique_id);
259 private:
260 tree<OfxGenericContainer *> security_tree;
261 tree<OfxGenericContainer *> account_tree;
262 };
263
264
265 #endif
OfxAccountData
An abstraction of an account.
Definition: inc/libofx.h:271
OfxSecurityContainer
Represents a security, such as a stock or bond.
Definition: ofx_containers.hh:181
OfxBalanceContainer::date
time_t date
Definition: ofx_containers.hh:119
OfxGenericContainer
A generic container for an OFX SGML element. Every container inherits from OfxGenericContainer.
Definition: ofx_containers.hh:33
OfxTransactionContainer
Represents a generic transaction.
Definition: ofx_containers.hh:201
std
LibofxContext
Definition: context.hh:25
OfxBalanceContainer::amount
double amount
Definition: ofx_containers.hh:117
OfxGenericContainer::tag_identifier
string tag_identifier
Definition: ofx_containers.hh:37
OfxStatementContainer
Represents a statement for either a bank account or a credit card account.
Definition: ofx_containers.hh:134
OfxStatusData
An abstraction of an OFX STATUS element.
Definition: inc/libofx.h:209
OfxInvestmentTransactionContainer
Represents a bank or credid card transaction.
Definition: ofx_containers.hh:232
OfxGenericContainer::type
string type
Definition: ofx_containers.hh:36
OfxPushUpContainer
A container to hold a OFX SGML element for which you want the parent to process it&#39;s data elements...
Definition: ofx_containers.hh:87
tree
Definition: tree.hh:105
OfxSecurityData
An abstraction of a security, such as a stock, mutual fund, etc.
Definition: inc/libofx.h:352
OfxTransactionData
An abstraction of a transaction in an account.
Definition: inc/libofx.h:475
OfxBankTransactionContainer
Represents a bank or credid card transaction.
Definition: ofx_containers.hh:221
OfxAccountContainer
Represents a bank account or a credit card account.
Definition: ofx_containers.hh:157
OfxMainContainer
The root container. Created by the <OFX> OFX element or by the export functions.
Definition: ofx_containers.hh:247
OfxStatementData
An abstraction of an account statement.
Definition: inc/libofx.h:637
OfxDummyContainer
A container to holds OFX SGML elements that LibOFX knows nothing about.
Definition: ofx_containers.hh:76
OfxBalanceContainer
Represents the <BALANCE> OFX SGML entity.
Definition: ofx_containers.hh:110
OfxStatusContainer
Represents the <STATUS> OFX SGML entity.
Definition: ofx_containers.hh:96