LibOFX
lib/context.hh
1 
5 /***************************************************************************
6  * *
7  * This program is free software; you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation; either version 2 of the License, or *
10  * (at your option) any later version. *
11  * *
12  ***************************************************************************/
13 
14 #ifndef CONTEXT_H
15 #define CONTEXT_H
16 #include <string.h>
17 #include <time.h> // for time_t
18 #include "libofx.h"
19 #include "ParserEventGeneratorKit.h"
20 
21 #include <string>
22 
23 
24 using namespace std;
25 class LibofxContext
26 {
27 private:
28  LibofxFileFormat _current_file_type;
29 
30  LibofxProcStatusCallback _statusCallback;
31  LibofxProcAccountCallback _accountCallback;
32  LibofxProcSecurityCallback _securityCallback;
33  LibofxProcTransactionCallback _transactionCallback;
34  LibofxProcStatementCallback _statementCallback;
35  LibofxProcPositionCallback _positionCallback;
36 
37  void * _statementData;
38  void * _accountData;
39  void * _transactionData;
40  void * _securityData;
41  void * _statusData;
42  void * _positionData;
43 
44  std::string _dtdDir;
45 
46 public:
47  LibofxContext();
48  ~LibofxContext();
49 
50  LibofxFileFormat currentFileType() const;
51  void setCurrentFileType(LibofxFileFormat t);
52 
53  const std::string &dtdDir() const
54  {
55  return _dtdDir;
56  };
57  void setDtdDir(const std::string &s)
58  {
59  _dtdDir = s;
60  };
61 
62  int statementCallback(const struct OfxStatementData data);
63  int accountCallback(const struct OfxAccountData data);
64  int transactionCallback(const struct OfxTransactionData data);
65  int securityCallback(const struct OfxSecurityData data);
66  int statusCallback(const struct OfxStatusData data);
67  int positionCallback(const struct OfxPositionData data);
68 
69  void setStatusCallback(LibofxProcStatusCallback cb, void *user_data);
70  void setAccountCallback(LibofxProcAccountCallback cb, void *user_data);
71  void setSecurityCallback(LibofxProcSecurityCallback cb, void *user_data);
72  void setTransactionCallback(LibofxProcTransactionCallback cb, void *user_data);
73  void setStatementCallback(LibofxProcStatementCallback cb, void *user_data);
74  void setPositionCallback(LibofxProcPositionCallback cb, void *user_data);
75 
76 
77 };//End class LibofxContext
78 
79 
80 
81 
82 #endif
An abstraction of an account.
Definition: inc/libofx.h:276
An abstraction of a security position held in an account.
Definition: inc/libofx.h:1161
int(* LibofxProcAccountCallback)(const struct OfxAccountData data, void *account_data)
The callback function for the OfxAccountData stucture.
Definition: inc/libofx.h:349
int(* LibofxProcStatementCallback)(const struct OfxStatementData data, void *statement_data)
The callback function for the OfxStatementData stucture.
Definition: inc/libofx.h:1142
int(* LibofxProcTransactionCallback)(const struct OfxTransactionData data, void *transaction_data)
The callback function for the OfxTransactionData stucture.
Definition: inc/libofx.h:1046
int(* LibofxProcPositionCallback)(const struct OfxPositionData data, void *position_data)
The callback function for the OfxPositionData stucture.
Definition: inc/libofx.h:1270
An abstraction of an OFX STATUS element.
Definition: inc/libofx.h:214
An abstraction of a security, such as a stock, mutual fund, etc.
Definition: inc/libofx.h:358
int(* LibofxProcSecurityCallback)(const struct OfxSecurityData data, void *security_data)
The callback function for the OfxSecurityData stucture.
Definition: inc/libofx.h:620
int(* LibofxProcStatusCallback)(const struct OfxStatusData data, void *status_data)
The callback function for the OfxStatusData stucture.
Definition: inc/libofx.h:263
An abstraction of a transaction in an account.
Definition: inc/libofx.h:682
LibofxFileFormat
Definition: inc/libofx.h:126
An abstraction of an account statement.
Definition: inc/libofx.h:1057