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
31 class OfxGenericContainer
32 {
33 public:
34 std::string type;
35 std::string tag_identifier;
36 OfxGenericContainer *parentcontainer;
37 LibofxContext *libofx_context;
38
39 OfxGenericContainer(LibofxContext *p_libofx_context);
40 OfxGenericContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer);
41 OfxGenericContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, std::string para_tag_identifier);
42
43 virtual ~OfxGenericContainer() {};
44
51 virtual void add_attribute(const std::string identifier, const std::string value);
57 virtual int gen_event();
58
64 virtual int add_to_main_tree();
65
67 OfxGenericContainer* getparent();
68 };//End class OfxGenericObject
69
74 class OfxDummyContainer: public OfxGenericContainer
75 {
76 public:
77 OfxDummyContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, std::string para_tag_identifier);
78 void add_attribute(const std::string identifier, const std::string value);
79 };
80
85 class OfxInv401kContainer: public OfxGenericContainer
86 {
87 public:
88 OfxInv401kContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, std::string para_tag_identifier);
89 void add_attribute(const std::string identifier, const std::string value);
90 };
91
96 class OfxPushUpContainer: public OfxGenericContainer
97 {
98 public:
99
100 OfxPushUpContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, std::string para_tag_identifier);
101 void add_attribute(const std::string identifier, const std::string value);
102 };
103
105 class OfxStatusContainer: public OfxGenericContainer
106 {
107 public:
108 OfxStatusData data;
109
110 OfxStatusContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, std::string para_tag_identifier);
111 ~OfxStatusContainer();
112 void add_attribute(const std::string identifier, const std::string value);
113 };
114
119 class OfxBalanceContainer: public OfxGenericContainer
120 {
121 public:
122 /* Not yet complete see spec 1.6 p.63 */
123 //std::string name;
124 //std::string description;
125 //enum BalanceType{DOLLAR, PERCENT, NUMBER} balance_type;
126 double amount;
127 bool amount_valid;
128 time_t date;
129 bool date_valid;
130
132 double margin_balance;
133 bool margin_balance_valid;
134
136 double short_balance;
137 bool short_balance_valid;
138
140 double buying_power;
141 bool buying_power_valid;
142
143 OfxBalanceContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, std::string para_tag_identifier);
144 ~OfxBalanceContainer();
145 void add_attribute(const std::string identifier, const std::string value);
146 };
147
148 /***************************************************************************
149 * OfxStatementContainer *
150 ***************************************************************************/
155 class OfxStatementContainer: public OfxGenericContainer
156 {
157 public:
158 OfxStatementData data;
159
160 OfxStatementContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, std::string para_tag_identifier);
161 ~OfxStatementContainer();
162 void add_attribute(const std::string identifier, const std::string value);
163 virtual int add_to_main_tree();
164 virtual int gen_event();
165 void add_account(OfxAccountData * account_data);
166 void add_balance(OfxBalanceContainer* ptr_balance_container);
167 // void add_transaction(const OfxTransactionData transaction_data);
168
169 };
170
171 /***************************************************************************
172 * OfxAccountContainer *
173 ***************************************************************************/
178 class OfxAccountContainer: public OfxGenericContainer
179 {
180 public:
181 OfxAccountData data;
182
183 OfxAccountContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, std::string para_tag_identifier);
184 ~OfxAccountContainer();
185 void add_attribute(const std::string identifier, const std::string value);
186 int add_to_main_tree();
187 virtual int gen_event();
188 private:
189 void gen_account_id(void);
190 std::string m_bankid;
191 std::string m_branchid;
192 std::string m_acctid;
193 std::string m_acctkey;
194 std::string m_brokerid;
195 };
196
197 /***************************************************************************
198 * OfxSecurityContainer *
199 ***************************************************************************/
202 class OfxSecurityContainer: public OfxGenericContainer
203 {
204 public:
205 OfxSecurityData data;
206
207 OfxSecurityContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, std::string para_tag_identifier);
208 ~OfxSecurityContainer();
209 void add_attribute(const std::string identifier, const std::string value);
210 virtual int gen_event();
211 virtual int add_to_main_tree();
212 private:
213 OfxStatementContainer * parent_statement;
214 };
215
216
217 /***************************************************************************
218 * OfxPositionContainer *
219 ***************************************************************************/
222 class OfxPositionContainer: public OfxGenericContainer
223 {
224 public:
225 OfxPositionData data;
226
227 OfxPositionContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, std::string para_tag_identifier);
228 ~OfxPositionContainer();
229 void add_attribute(const std::string identifier, const std::string value);
230 void add_account(OfxAccountData * account_data);
231 virtual int gen_event();
232 virtual int add_to_main_tree();
233 private:
234 OfxStatementContainer * parent_statement;
235 };
236
237
238 /***************************************************************************
239 * OfxTransactionContainer *
240 ***************************************************************************/
243 class OfxTransactionContainer: public OfxGenericContainer
244 {
245 public:
246 OfxTransactionData data;
247
248 OfxTransactionContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, std::string para_tag_identifier);
249 ~OfxTransactionContainer();
250 virtual void add_attribute(const std::string identifier, const std::string value);
251 void add_account(OfxAccountData * account_data);
252
253 virtual int gen_event();
254 virtual int add_to_main_tree();
255 private:
256 OfxStatementContainer * parent_statement;
257 };
258
263 class OfxBankTransactionContainer: public OfxTransactionContainer
264 {
265 public:
266 OfxBankTransactionContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, std::string para_tag_identifier);
267 void add_attribute(const std::string identifier, const std::string value);
268 };
269
274 class OfxInvestmentTransactionContainer: public OfxTransactionContainer
275 {
276 public:
277 OfxInvestmentTransactionContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, std::string para_tag_identifier);
278
279 void add_attribute(const std::string identifier, const std::string value);
280 };
281
282 /***************************************************************************
283 * OfxMainContainer *
284 ***************************************************************************/
289 class OfxMainContainer: public OfxGenericContainer
290 {
291 public:
292 OfxMainContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, std::string para_tag_identifier);
293 ~OfxMainContainer();
294 int add_container(OfxGenericContainer * container);
295 int add_container(OfxStatementContainer * container);
296 int add_container(OfxAccountContainer * container);
297 int add_container(OfxTransactionContainer * container);
298 int add_container(OfxSecurityContainer * container);
299 int add_container(OfxPositionContainer * container);
300 int gen_event();
301 OfxSecurityData * find_security(std::string unique_id);
302 private:
303 tree<OfxGenericContainer *> security_tree;
304 tree<OfxGenericContainer *> account_tree;
305 };
306
307
308 #endif
OfxGenericContainer::type
std::string type
Definition: ofx_containers.hh:41
OfxBalanceContainer::add_attribute
void add_attribute(const std::string identifier, const std::string value)
Add data to a container object.
Definition: ofx_containers_misc.cpp:167
OfxBalanceContainer::date_valid
bool date_valid
Definition: ofx_containers.hh:129
OfxAccountContainer::add_attribute
void add_attribute(const std::string identifier, const std::string value)
Add data to a container object.
Definition: ofx_container_account.cpp:67
OfxDummyContainer
A container to hold OFX SGML elements that LibOFX knows nothing about.
Definition: ofx_containers.hh:74
OfxSecurityData
An abstraction of a security, such as a stock, mutual fund, etc.
Definition: inc/libofx.h:369
OfxPositionContainer::add_to_main_tree
virtual int add_to_main_tree()
Add this container to the main tree.
Definition: ofx_container_position.cpp:181
OfxTransactionContainer::gen_event
virtual int gen_event()
Generate libofx.h events.
Definition: ofx_container_transaction.cpp:68
OfxStatusContainer::add_attribute
void add_attribute(const std::string identifier, const std::string value)
Add data to a container object.
Definition: ofx_containers_misc.cpp:94
OfxTransactionData
An abstraction of a transaction in an account.
Definition: inc/libofx.h:693
OfxPositionContainer::gen_event
virtual int gen_event()
Generate libofx.h events.
Definition: ofx_container_position.cpp:158
OfxTransactionContainer::add_to_main_tree
virtual int add_to_main_tree()
Add this container to the main tree.
Definition: ofx_container_transaction.cpp:82
OfxAccountData
An abstraction of an account.
Definition: inc/libofx.h:287
OfxMainContainer
The root container. Created by the <OFX> OFX element or by the export functions.
Definition: ofx_containers.hh:289
OfxBalanceContainer::amount
double amount
Definition: ofx_containers.hh:126
OfxStatusContainer
Represents the <STATUS> OFX SGML entity.
Definition: ofx_containers.hh:105
OfxPushUpContainer::add_attribute
void add_attribute(const std::string identifier, const std::string value)
Add data to a container object.
Definition: ofx_containers_misc.cpp:62
OfxGenericContainer::gen_event
virtual int gen_event()
Generate libofx.h events.
Definition: ofx_container_generic.cpp:68
OfxInvestmentTransactionContainer
Represents a bank or credid card transaction.
Definition: ofx_containers.hh:274
OfxMainContainer::gen_event
int gen_event()
Generate libofx.h events.
Definition: ofx_container_main.cpp:183
OfxStatusData
An abstraction of an OFX STATUS element.
Definition: inc/libofx.h:225
OfxAccountContainer
Represents a bank account or a credit card account.
Definition: ofx_containers.hh:178
OfxSecurityContainer::add_to_main_tree
virtual int add_to_main_tree()
Add this container to the main tree.
Definition: ofx_container_security.cpp:348
OfxBankTransactionContainer
Represents a bank or credid card transaction.
Definition: ofx_containers.hh:263
OfxAccountContainer::add_to_main_tree
int add_to_main_tree()
Add this container to the main tree.
Definition: ofx_container_account.cpp:135
OfxStatementData
An abstraction of an account statement.
Definition: inc/libofx.h:1068
OfxSecurityContainer::gen_event
virtual int gen_event()
Generate libofx.h events.
Definition: ofx_container_security.cpp:342
OfxSecurityContainer
Represents a security, such as a stock or bond.
Definition: ofx_containers.hh:202
OfxGenericContainer
A generic container for an OFX SGML element. Every container inherits from OfxGenericContainer.
Definition: ofx_containers.hh:31
OfxInv401kContainer::add_attribute
void add_attribute(const std::string identifier, const std::string value)
Add data to a container object.
Definition: ofx_containers_misc.cpp:211
OfxGenericContainer::add_attribute
virtual void add_attribute(const std::string identifier, const std::string value)
Add data to a container object.
Definition: ofx_container_generic.cpp:57
LibofxContext
Definition: context.hh:23
OfxBalanceContainer::short_balance_valid
bool short_balance_valid
Definition: ofx_containers.hh:137
OfxBankTransactionContainer::add_attribute
void add_attribute(const std::string identifier, const std::string value)
Add data to a container object.
Definition: ofx_container_transaction.cpp:176
OfxInv401kContainer
A container to hold OFX SGML elements for <INV401K>
Definition: ofx_containers.hh:85
OfxAccountContainer::gen_event
virtual int gen_event()
Generate libofx.h events.
Definition: ofx_container_account.cpp:129
OfxStatementContainer::add_to_main_tree
virtual int add_to_main_tree()
Add this container to the main tree.
Definition: ofx_container_statement.cpp:116
OfxBalanceContainer
Represents the <BALANCE>, <INVBAL> or <INV401KBAL> OFX SGML entity.
Definition: ofx_containers.hh:119
OfxPositionContainer::add_attribute
void add_attribute(const std::string identifier, const std::string value)
Add data to a container object.
Definition: ofx_container_position.cpp:45
OfxStatementContainer::gen_event
virtual int gen_event()
Generate libofx.h events.
Definition: ofx_container_statement.cpp:128
OfxGenericContainer::getparent
OfxGenericContainer * getparent()
Returns the parent container object (the one representing the containing OFX SGML element)
Definition: ofx_container_generic.cpp:63
OfxInvestmentTransactionContainer::add_attribute
void add_attribute(const std::string identifier, const std::string value)
Add data to a container object.
Definition: ofx_container_transaction.cpp:390
OfxStatementContainer
Represents a statement for either a bank account or a credit card account.
Definition: ofx_containers.hh:155
OfxSecurityContainer::add_attribute
void add_attribute(const std::string identifier, const std::string value)
Add data to a container object.
Definition: ofx_container_security.cpp:58
OfxDummyContainer::add_attribute
void add_attribute(const std::string identifier, const std::string value)
Add data to a container object.
Definition: ofx_containers_misc.cpp:47
OfxTransactionContainer
Represents a generic transaction.
Definition: ofx_containers.hh:243
OfxBalanceContainer::margin_balance_valid
bool margin_balance_valid
Definition: ofx_containers.hh:133
OfxBalanceContainer::date
time_t date
Definition: ofx_containers.hh:128
OfxPushUpContainer
A container to hold a OFX SGML element for which you want the parent to process it's data elements.
Definition: ofx_containers.hh:96
OfxPositionContainer
Represents an investment position, such as a stock or bond.
Definition: ofx_containers.hh:222
tree< OfxGenericContainer * >
OfxGenericContainer::tag_identifier
std::string tag_identifier
Definition: ofx_containers.hh:42
OfxTransactionContainer::add_attribute
virtual void add_attribute(const std::string identifier, const std::string value)
Add data to a container object.
Definition: ofx_container_transaction.cpp:96
OfxGenericContainer::add_to_main_tree
virtual int add_to_main_tree()
Add this container to the main tree.
Definition: ofx_container_generic.cpp:74
OfxPositionData
An abstraction of a security position held in an account.
Definition: inc/libofx.h:1172
OfxStatementContainer::add_attribute
void add_attribute(const std::string identifier, const std::string value)
Add data to a container object.
Definition: ofx_container_statement.cpp:50