ofx_containers.hh
Go to the documentation of this file.

    00001 /***************************************************************************
    00002                           ofx_proc_rs.h
    00003                              -------------------
    00004     copyright            : (C) 2002 by Benoit Gr�goire
    00005     email                : benoitg@coeus.ca
    00006 ***************************************************************************/
    00013 /***************************************************************************
    00014  *                                                                         *
    00015  *   This program is free software; you can redistribute it and/or modify  *
    00016  *   it under the terms of the GNU General Public License as published by  *
    00017  *   the Free Software Foundation; either version 2 of the License, or     *
    00018  *   (at your option) any later version.                                   *
    00019  *                                                                         *
    00020  ***************************************************************************/
    00021 #ifndef OFX_PROC_H
    00022 #define OFX_PROC_H
    00023 #include "libofx.h"
    00024 #include "tree.hh"
    00025 #include "context.hh"
    00026
    00027 using namespace std;
    00028
    00033 class OfxGenericContainer
    00034 {
    00035 public:
    00036   string type;
    00037   string tag_identifier;
    00038   OfxGenericContainer *parentcontainer;
    00039   LibofxContext *libofx_context;
    00040
    00041   OfxGenericContainer(LibofxContext *p_libofx_context);
    00042   OfxGenericContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer);
    00043   OfxGenericContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, string para_tag_identifier);
    00044
    00045   virtual ~OfxGenericContainer() {};
    00046
    00053   virtual void add_attribute(const string identifier, const string value);
    00059   virtual int gen_event();
    00060
    00066   virtual int add_to_main_tree();
    00067
    00069   OfxGenericContainer* getparent();
    00070 };//End class OfxGenericObject
    00071
    00076 class OfxDummyContainer: public OfxGenericContainer
    00077 {
    00078 public:
    00079   OfxDummyContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, string para_tag_identifier);
    00080   void add_attribute(const string identifier, const string value);
    00081 };
    00082
    00087 class OfxPushUpContainer: public OfxGenericContainer
    00088 {
    00089 public:
    00090
    00091   OfxPushUpContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, string para_tag_identifier);
    00092   void add_attribute(const string identifier, const string value);
    00093 };
    00094
    00096 class OfxStatusContainer: public OfxGenericContainer
    00097 {
    00098 public:
    00099   OfxStatusData data;
    00100
    00101   OfxStatusContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, string para_tag_identifier);
    00102   ~OfxStatusContainer();
    00103   void add_attribute(const string identifier, const string value);
    00104 };
    00105
    00110 class OfxBalanceContainer: public OfxGenericContainer
    00111 {
    00112 public:
    00113   /* Not yet complete see spec 1.6 p.63 */
    00114   //char name[OFX_BALANCE_NAME_LENGTH];
    00115   //char description[OFX_BALANCE_DESCRIPTION_LENGTH];
    00116   //enum BalanceType{DOLLAR, PERCENT, NUMBER} balance_type;
    00117   double amount;
    00118   int amount_valid;
    00119   time_t date;
    00120   int date_valid;
    00121
    00122   OfxBalanceContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, string para_tag_identifier);
    00123   ~OfxBalanceContainer();
    00124   void add_attribute(const string identifier, const string value);
    00125 };
    00126
    00127 /***************************************************************************
    00128  *                          OfxStatementContainer                          *
    00129  ***************************************************************************/
    00134 class OfxStatementContainer: public OfxGenericContainer
    00135 {
    00136 public:
    00137   OfxStatementData data;
    00138
    00139   OfxStatementContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, string para_tag_identifier);
    00140   ~OfxStatementContainer();
    00141   void add_attribute(const string identifier, const string value);
    00142   virtual int add_to_main_tree();
    00143   virtual int gen_event();
    00144   void add_account(OfxAccountData * account_data);
    00145   void add_balance(OfxBalanceContainer* ptr_balance_container);
    00146 //  void add_transaction(const OfxTransactionData transaction_data);
    00147
    00148 };
    00149
    00150 /***************************************************************************
    00151  *                           OfxAccountContaine r                          *
    00152  ***************************************************************************/
    00157 class OfxAccountContainer: public OfxGenericContainer
    00158 {
    00159 public:
    00160   OfxAccountData data;
    00161
    00162   OfxAccountContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, string para_tag_identifier);
    00163   ~OfxAccountContainer();
    00164   void add_attribute(const string identifier, const string value);
    00165   int add_to_main_tree();
    00166   virtual int gen_event();
    00167 private:
    00168   void gen_account_id(void);
    00169   char bankid[OFX_BANKID_LENGTH];
    00170   char branchid[OFX_BRANCHID_LENGTH];
    00171   char acctid[OFX_ACCTID_LENGTH];
    00172   char acctkey[OFX_ACCTKEY_LENGTH];
    00173   char brokerid[OFX_BROKERID_LENGTH];
    00174 };
    00175
    00176 /***************************************************************************
    00177  *                           OfxSecurityContainer                          *
    00178  ***************************************************************************/
    00181 class OfxSecurityContainer: public OfxGenericContainer
    00182 {
    00183 public:
    00184   OfxSecurityData data;
    00185
    00186   OfxSecurityContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, string para_tag_identifier);
    00187   ~OfxSecurityContainer();
    00188   void add_attribute(const string identifier, const string value);
    00189   virtual int gen_event();
    00190   virtual int add_to_main_tree();
    00191 private:
    00192   OfxStatementContainer * parent_statement;
    00193 };
    00194
    00195
    00196 /***************************************************************************
    00197  *                        OfxTransactionContainer                          *
    00198  ***************************************************************************/
    00201 class OfxTransactionContainer: public OfxGenericContainer
    00202 {
    00203 public:
    00204   OfxTransactionData data;
    00205
    00206   OfxTransactionContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, string para_tag_identifier);
    00207   ~OfxTransactionContainer();
    00208   virtual void add_attribute(const string identifier, const string value);
    00209   void add_account(OfxAccountData * account_data);
    00210
    00211   virtual int gen_event();
    00212   virtual int add_to_main_tree();
    00213 private:
    00214   OfxStatementContainer * parent_statement;
    00215 };
    00216
    00221 class OfxBankTransactionContainer: public OfxTransactionContainer
    00222 {
    00223 public:
    00224   OfxBankTransactionContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, string para_tag_identifier);
    00225   void add_attribute(const string identifier, const string value);
    00226 };
    00227
    00232 class OfxInvestmentTransactionContainer: public OfxTransactionContainer
    00233 {
    00234 public:
    00235   OfxInvestmentTransactionContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, string para_tag_identifier);
    00236
    00237   void add_attribute(const string identifier, const string value);
    00238 };
    00239
    00240 /***************************************************************************
    00241  *                             OfxMainContainer                            *
    00242  ***************************************************************************/
    00247 class OfxMainContainer: public OfxGenericContainer
    00248 {
    00249 public:
    00250   OfxMainContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, string para_tag_identifier);
    00251   ~OfxMainContainer();
    00252   int add_container(OfxGenericContainer * container);
    00253   int add_container(OfxStatementContainer * container);
    00254   int add_container(OfxAccountContainer * container);
    00255   int add_container(OfxTransactionContainer * container);
    00256   int add_container(OfxSecurityContainer * container);
    00257   int gen_event();
    00258   OfxSecurityData * find_security(string unique_id);
    00259 private:
    00260   tree<OfxGenericContainer *> security_tree;
    00261   tree<OfxGenericContainer *> account_tree;
    00262 };
    00263
    00264
    00265 #endif