LibOFX: context.cpp Source File

- Main Page
- Namespaces
- Data Structures
- Files

- File List
- Globals

# context.cpp

    00001
    00005 /***************************************************************************
    00006  *                                                                         *
    00007  *   This program is free software; you can redistribute it and/or modify  *
    00008  *   it under the terms of the GNU General Public License as published by  *
    00009  *   the Free Software Foundation; either version 2 of the License, or     *
    00010  *   (at your option) any later version.                                   *
    00011  *                                                                         *
    00012  ***************************************************************************/
    00013 #include <config.h>
    00014 #include "context.hh"
    00015
    00016 using namespace std;
    00017
    00018
    00019
    00020 LibofxContext::LibofxContext()
    00021   :_current_file_type(OFX)
    00022   ,_statusCallback(0)
    00023   ,_accountCallback(0)
    00024   ,_securityCallback(0)
    00025   ,_transactionCallback(0)
    00026   ,_statementCallback(0)
    00027   ,_statementData(0)
    00028   ,_accountData(0)
    00029   ,_transactionData(0)
    00030   ,_securityData(0)
    00031   ,_statusData(0)
    00032 {
    00033
    00034 }
    00035
    00036
    00037
    00038 LibofxContext::~LibofxContext(){
    00039 }
    00040
    00041
    00042
    00043 LibofxFileFormat LibofxContext::currentFileType() const{
    00044   return _current_file_type;
    00045 }
    00046
    00047
    00048
    00049 void LibofxContext::setCurrentFileType(LibofxFileFormat t) {
    00050   _current_file_type=t;
    00051 }
    00052
    00053
    00054
    00055 int LibofxContext::statementCallback(const struct OfxStatementData data){
    00056   if (_statementCallback)
    00057     return _statementCallback(data, _statementData);
    00058   return 0;
    00059 }
    00060
    00061
    00062
    00063 int LibofxContext::accountCallback(const struct OfxAccountData data){
    00064   if (_accountCallback)
    00065     return _accountCallback(data, _accountData);
    00066   return 0;
    00067 }
    00068
    00069
    00070
    00071 int LibofxContext::transactionCallback(const struct OfxTransactionData data){
    00072   if (_transactionCallback)
    00073     return _transactionCallback(data, _transactionData);
    00074   return 0;
    00075 }
    00076
    00077
    00078
    00079 int LibofxContext::securityCallback(const struct OfxSecurityData data) {
    00080   if (_securityCallback)
    00081     return _securityCallback(data, _securityData);
    00082   return 0;
    00083 }
    00084
    00085
    00086
    00087 int LibofxContext::statusCallback(const struct OfxStatusData data) {
    00088   if (_statusCallback)
    00089     return _statusCallback(data, _statusData);
    00090   return 0;
    00091 }
    00092
    00093
    00094 void LibofxContext::setStatusCallback(LibofxProcStatusCallback cb,
    00095                                       void *user_data){
    00096   _statusCallback=cb;
    00097   _statusData=user_data;
    00098 }
    00099
    00100
    00101
    00102 void LibofxContext::setAccountCallback(LibofxProcAccountCallback cb,
    00103                                        void *user_data){
    00104   _accountCallback=cb;
    00105   _accountData=user_data;
    00106 }
    00107
    00108
    00109
    00110 void LibofxContext::setSecurityCallback(LibofxProcSecurityCallback cb,
    00111                                         void *user_data){
    00112   _securityCallback=cb;
    00113   _securityData=user_data;
    00114 }
    00115
    00116
    00117
    00118 void LibofxContext::setTransactionCallback(LibofxProcTransactionCallback cb,
    00119                                            void *user_data){
    00120   _transactionCallback=cb;
    00121   _transactionData=user_data;
    00122 }
    00123
    00124
    00125
    00126 void LibofxContext::setStatementCallback(LibofxProcStatementCallback cb,
    00127                                          void *user_data){
    00128   _statementCallback=cb;
    00129   _statementData=user_data;
    00130 }
    00131
    00132
    00133
    00134
    00135
    00136
    00137
    00140 CFCT LibofxContextPtr libofx_get_new_context(){
    00141   return new LibofxContext();
    00142 }
    00143
    00144 CFCT int libofx_free_context( LibofxContextPtr libofx_context_param){
    00145   delete (LibofxContext *)libofx_context_param;
    00146   return 0;
    00147 }
    00148
    00149
    00150
    00151 CFCT void libofx_set_dtd_dir(LibofxContextPtr libofx_context,
    00152                             const char *s) {
    00153   ((LibofxContext*)libofx_context)->setDtdDir(s);
    00154 }
    00155
    00156
    00157
    00158
    00159
    00160
    00161 extern "C" {
    00162   void ofx_set_status_cb(LibofxContextPtr ctx,
    00163                          LibofxProcStatusCallback cb,
    00164                          void *user_data){
    00165     ((LibofxContext*)ctx)->setStatusCallback(cb, user_data);
    00166   }
    00167
    00168
    00169   void ofx_set_account_cb(LibofxContextPtr ctx,
    00170                           LibofxProcAccountCallback cb,
    00171                           void *user_data){
    00172     ((LibofxContext*)ctx)->setAccountCallback(cb, user_data);
    00173   }
    00174
    00175
    00176
    00177   void ofx_set_security_cb(LibofxContextPtr ctx,
    00178                            LibofxProcSecurityCallback cb,
    00179                            void *user_data){
    00180     ((LibofxContext*)ctx)->setSecurityCallback(cb, user_data);
    00181   }
    00182
    00183
    00184
    00185   void ofx_set_transaction_cb(LibofxContextPtr ctx,
    00186                               LibofxProcTransactionCallback cb,
    00187                               void *user_data){
    00188     ((LibofxContext*)ctx)->setTransactionCallback(cb, user_data);
    00189   }
    00190
    00191
    00192
    00193   void ofx_set_statement_cb(LibofxContextPtr ctx,
    00194                             LibofxProcStatementCallback cb,
    00195                             void *user_data){
    00196     ((LibofxContext*)ctx)->setStatementCallback(cb, user_data);
    00197   }
    00198
    00199
    00200
    00201
    00202 }
    00203
    00204
    00205
    00206
    00207
    00208
    00209
    00210
    00211
    00212