LibOFX

lib/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 OfxInv401kContainer: public OfxGenericContainer
88 {
89 public:
90 OfxInv401kContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, string para_tag_identifier);
91 void add_attribute(const string identifier, const string value);
92 };
93
98 class OfxPushUpContainer: public OfxGenericContainer
99 {
100 public:
101
102 OfxPushUpContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, string para_tag_identifier);
103 void add_attribute(const string identifier, const string value);
104 };
105
107 class OfxStatusContainer: public OfxGenericContainer
108 {
109 public:
110 OfxStatusData data;
111
112 OfxStatusContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, string para_tag_identifier);
113 ~OfxStatusContainer();
114 void add_attribute(const string identifier, const string value);
115 };
116
121 class OfxBalanceContainer: public OfxGenericContainer
122 {
123 public:
124 /* Not yet complete see spec 1.6 p.63 */
125 //char name[OFX_BALANCE_NAME_LENGTH];
126 //char description[OFX_BALANCE_DESCRIPTION_LENGTH];
127 //enum BalanceType{DOLLAR, PERCENT, NUMBER} balance_type;
128 double amount;
129 bool amount_valid;
130 time_t date;
131 bool date_valid;
132
134 double margin_balance;
135 bool margin_balance_valid;
136
138 double short_balance;
139 bool short_balance_valid;
140
142 double buying_power;
143 bool buying_power_valid;
144
145 OfxBalanceContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, string para_tag_identifier);
146 ~OfxBalanceContainer();
147 void add_attribute(const string identifier, const string value);
148 };
149
150 /***************************************************************************
151 * OfxStatementContainer *
152 ***************************************************************************/
157 class OfxStatementContainer: public OfxGenericContainer
158 {
159 public:
160 OfxStatementData data;
161
162 OfxStatementContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, string para_tag_identifier);
163 ~OfxStatementContainer();
164 void add_attribute(const string identifier, const string value);
165 virtual int add_to_main_tree();
166 virtual int gen_event();
167 void add_account(OfxAccountData * account_data);
168 void add_balance(OfxBalanceContainer* ptr_balance_container);
169 // void add_transaction(const OfxTransactionData transaction_data);
170
171 };
172
173 /***************************************************************************
174 * OfxAccountContainer *
175 ***************************************************************************/
180 class OfxAccountContainer: public OfxGenericContainer
181 {
182 public:
183 OfxAccountData data;
184
185 OfxAccountContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, string para_tag_identifier);
186 ~OfxAccountContainer();
187 void add_attribute(const string identifier, const string value);
188 int add_to_main_tree();
189 virtual int gen_event();
190 private:
191 void gen_account_id(void);
192 char bankid[OFX_BANKID_LENGTH];
193 char branchid[OFX_BRANCHID_LENGTH];
194 char acctid[OFX_ACCTID_LENGTH];
195 char acctkey[OFX_ACCTKEY_LENGTH];
196 char brokerid[OFX_BROKERID_LENGTH];
197 };
198
199 /***************************************************************************
200 * OfxSecurityContainer *
201 ***************************************************************************/
204 class OfxSecurityContainer: public OfxGenericContainer
205 {
206 public:
207 OfxSecurityData data;
208
209 OfxSecurityContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, string para_tag_identifier);
210 ~OfxSecurityContainer();
211 void add_attribute(const string identifier, const string value);
212 virtual int gen_event();
213 virtual int add_to_main_tree();
214 private:
215 OfxStatementContainer * parent_statement;
216 };
217
218
219 /***************************************************************************
220 * OfxPositionContainer *
221 ***************************************************************************/
224 class OfxPositionContainer: public OfxGenericContainer
225 {
226 public:
227 OfxPositionData data;
228
229 OfxPositionContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, string para_tag_identifier);
230 ~OfxPositionContainer();
231 void add_attribute(const string identifier, const string value);
232 void add_account(OfxAccountData * account_data);
233 virtual int gen_event();
234 virtual int add_to_main_tree();
235 private:
236 OfxStatementContainer * parent_statement;
237 };
238
239
240 /***************************************************************************
241 * OfxTransactionContainer *
242 ***************************************************************************/
245 class OfxTransactionContainer: public OfxGenericContainer
246 {
247 public:
248 OfxTransactionData data;
249
250 OfxTransactionContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, string para_tag_identifier);
251 ~OfxTransactionContainer();
252 virtual void add_attribute(const string identifier, const string value);
253 void add_account(OfxAccountData * account_data);
254
255 virtual int gen_event();
256 virtual int add_to_main_tree();
257 private:
258 OfxStatementContainer * parent_statement;
259 };
260
265 class OfxBankTransactionContainer: public OfxTransactionContainer
266 {
267 public:
268 OfxBankTransactionContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, string para_tag_identifier);
269 void add_attribute(const string identifier, const string value);
270 };
271
276 class OfxInvestmentTransactionContainer: public OfxTransactionContainer
277 {
278 public:
279 OfxInvestmentTransactionContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, string para_tag_identifier);
280
281 void add_attribute(const string identifier, const string value);
282 };
283
284 /***************************************************************************
285 * OfxMainContainer *
286 ***************************************************************************/
291 class OfxMainContainer: public OfxGenericContainer
292 {
293 public:
294 OfxMainContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, string para_tag_identifier);
295 ~OfxMainContainer();
296 int add_container(OfxGenericContainer * container);
297 int add_container(OfxStatementContainer * container);
298 int add_container(OfxAccountContainer * container);
299 int add_container(OfxTransactionContainer * container);
300 int add_container(OfxSecurityContainer * container);
301 int add_container(OfxPositionContainer * container);
302 int gen_event();
303 OfxSecurityData * find_security(string unique_id);
304 private:
305 tree<OfxGenericContainer *> security_tree;
306 tree<OfxGenericContainer *> account_tree;
307 };
308
309
310 #endif
OfxAccountData
An abstraction of an account.
Definition: inc/libofx.h:276
OfxSecurityContainer
Represents a security, such as a stock or bond.
Definition: build/libofx-0.10.0/lib/ofx_containers.hh:204
OfxGenericContainer
A generic container for an OFX SGML element. Every container inherits from OfxGenericContainer.
Definition: build/libofx-0.10.0/lib/ofx_containers.hh:33
OfxPositionData
An abstraction of a security position held in an account.
Definition: inc/libofx.h:1161
OfxTransactionContainer
Represents a generic transaction.
Definition: build/libofx-0.10.0/lib/ofx_containers.hh:245
std
LibofxContext
Definition: build/libofx-0.10.0/lib/context.hh:25
OfxStatementContainer
Represents a statement for either a bank account or a credit card account.
Definition: build/libofx-0.10.0/lib/ofx_containers.hh:157
OfxStatusData
An abstraction of an OFX STATUS element.
Definition: inc/libofx.h:214
OfxInvestmentTransactionContainer
Represents a bank or credid card transaction.
Definition: build/libofx-0.10.0/lib/ofx_containers.hh:276
OfxPushUpContainer
A container to hold a OFX SGML element for which you want the parent to process it&#39;s data elements...
Definition: build/libofx-0.10.0/lib/ofx_containers.hh:98
OfxPositionContainer
Represents an investment position, such as a stock or bond.
Definition: build/libofx-0.10.0/lib/ofx_containers.hh:224
tree
Definition: build/libofx-0.10.0/lib/tree.hh:105
OfxSecurityData
An abstraction of a security, such as a stock, mutual fund, etc.
Definition: inc/libofx.h:358
OfxTransactionData
An abstraction of a transaction in an account.
Definition: inc/libofx.h:682
OfxBankTransactionContainer
Represents a bank or credid card transaction.
Definition: build/libofx-0.10.0/lib/ofx_containers.hh:265
OfxAccountContainer
Represents a bank account or a credit card account.
Definition: build/libofx-0.10.0/lib/ofx_containers.hh:180
OfxMainContainer
The root container. Created by the <OFX> OFX element or by the export functions.
Definition: build/libofx-0.10.0/lib/ofx_containers.hh:291
OfxStatementData
An abstraction of an account statement.
Definition: inc/libofx.h:1057
OfxDummyContainer
A container to hold OFX SGML elements that LibOFX knows nothing about.
Definition: build/libofx-0.10.0/lib/ofx_containers.hh:76
OfxBalanceContainer
Represents the <BALANCE>, <INVBAL> or <INV401KBAL> OFX SGML entity.
Definition: build/libofx-0.10.0/lib/ofx_containers.hh:121
OfxInv401kContainer
A container to hold OFX SGML elements for <INV401K>
Definition: build/libofx-0.10.0/lib/ofx_containers.hh:87
OfxStatusContainer
Represents the <STATUS> OFX SGML entity.
Definition: build/libofx-0.10.0/lib/ofx_containers.hh:107