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
32{
33public:
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
68};//End class OfxGenericObject
69
75{
76public:
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
86{
87public:
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
97{
98public:
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
106{
107public:
108 OfxStatusData data;
109
110 OfxStatusContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, std::string para_tag_identifier);
112 void add_attribute(const std::string identifier, const std::string value);
113};
114
120{
121public:
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;
130
132 double margin_balance;
134
136 double short_balance;
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);
145 void add_attribute(const std::string identifier, const std::string value);
146};
147
148/***************************************************************************
149 * OfxStatementContainer *
150 ***************************************************************************/
156{
157public:
158 OfxStatementData data;
159
160 OfxStatementContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, std::string para_tag_identifier);
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 ***************************************************************************/
179{
180public:
181 OfxAccountData data;
182
183 OfxAccountContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, std::string para_tag_identifier);
185 void add_attribute(const std::string identifier, const std::string value);
186 int add_to_main_tree();
187 virtual int gen_event();
188private:
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 ***************************************************************************/
203{
204public:
205 OfxSecurityData data;
206
207 OfxSecurityContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, std::string para_tag_identifier);
209 void add_attribute(const std::string identifier, const std::string value);
210 virtual int gen_event();
211 virtual int add_to_main_tree();
212private:
213 OfxStatementContainer * parent_statement;
214};
215
216
217/***************************************************************************
218 * OfxPositionContainer *
219 ***************************************************************************/
223{
224public:
225 OfxPositionData data;
226
227 OfxPositionContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, std::string para_tag_identifier);
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();
233private:
234 OfxStatementContainer * parent_statement;
235};
236
237
238/***************************************************************************
239 * OfxTransactionContainer *
240 ***************************************************************************/
244{
245public:
247
248 OfxTransactionContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, std::string para_tag_identifier);
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();
255private:
256 OfxStatementContainer * parent_statement;
257};
258
264{
265public:
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
275{
276public:
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 ***************************************************************************/
290{
291public:
292 OfxMainContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, std::string para_tag_identifier);
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);
302private:
303 tree<OfxGenericContainer *> security_tree;
304 tree<OfxGenericContainer *> account_tree;
305};
306
307
308#endif
Represents a bank account or a credit card account.
virtual int gen_event()
Generate libofx.h events.
void add_attribute(const std::string identifier, const std::string value)
Add data to a container object.
int add_to_main_tree()
Add this container to the main tree.
Represents the <BALANCE>, <INVBAL> or <INV401KBAL> OFX SGML entity.
void add_attribute(const std::string identifier, const std::string value)
Add data to a container object.
Represents a bank or credid card transaction.
void add_attribute(const std::string identifier, const std::string value)
Add data to a container object.
A container to hold OFX SGML elements that LibOFX knows nothing about.
void add_attribute(const std::string identifier, const std::string value)
Add data to a container object.
A generic container for an OFX SGML element. Every container inherits from OfxGenericContainer.
std::string tag_identifier
OfxGenericContainer * getparent()
Returns the parent container object (the one representing the containing OFX SGML element)
virtual int gen_event()
Generate libofx.h events.
virtual void add_attribute(const std::string identifier, const std::string value)
Add data to a container object.
virtual int add_to_main_tree()
Add this container to the main tree.
A container to hold OFX SGML elements for <INV401K>
void add_attribute(const std::string identifier, const std::string value)
Add data to a container object.
Represents a bank or credid card transaction.
void add_attribute(const std::string identifier, const std::string value)
Add data to a container object.
The root container. Created by the <OFX> OFX element or by the export functions.
int gen_event()
Generate libofx.h events.
Represents an investment position, such as a stock or bond.
virtual int add_to_main_tree()
Add this container to the main tree.
virtual int gen_event()
Generate libofx.h events.
void add_attribute(const std::string identifier, const std::string value)
Add data to a container object.
A container to hold a OFX SGML element for which you want the parent to process it's data elements.
void add_attribute(const std::string identifier, const std::string value)
Add data to a container object.
Represents a security, such as a stock or bond.
virtual int gen_event()
Generate libofx.h events.
void add_attribute(const std::string identifier, const std::string value)
Add data to a container object.
virtual int add_to_main_tree()
Add this container to the main tree.
Represents a statement for either a bank account or a credit card account.
virtual int gen_event()
Generate libofx.h events.
virtual int add_to_main_tree()
Add this container to the main tree.
void add_attribute(const std::string identifier, const std::string value)
Add data to a container object.
Represents the <STATUS> OFX SGML entity.
void add_attribute(const std::string identifier, const std::string value)
Add data to a container object.
Represents a generic transaction.
virtual int gen_event()
Generate libofx.h events.
virtual void add_attribute(const std::string identifier, const std::string value)
Add data to a container object.
virtual int add_to_main_tree()
Add this container to the main tree.
Definition tree.hh:107
Main header file containing the LibOfx API.
An abstraction of an account.
Definition libofx.h:288
An abstraction of a security position held in an account.
Definition libofx.h:1173
An abstraction of a security, such as a stock, mutual fund, etc.
Definition libofx.h:370
An abstraction of an account statement.
Definition libofx.h:1069
An abstraction of an OFX STATUS element.
Definition libofx.h:226
An abstraction of a transaction in an account.
Definition libofx.h:694