39 memset(&data, 0,
sizeof(data));
42 OfxPositionContainer::~OfxPositionContainer()
47 if (identifier ==
"UNIQUEID")
51 else if (identifier ==
"UNIQUEIDTYPE")
55 else if (identifier ==
"HELDINACCT")
61 else if (value ==
"MARGIN")
65 else if (value ==
"SHORT")
69 else if (value ==
"OTHER")
74 else if (identifier ==
"POSTYPE")
78 ASSIGN(data.position_type, data.OFX_POSITION_SHORT);
80 else if (value ==
"LONG")
82 ASSIGN(data.position_type, data.OFX_POSITION_LONG);
85 else if (identifier ==
"UNITS")
89 else if (identifier ==
"UNITPRICE")
93 else if (identifier ==
"MKTVAL")
97 else if (identifier ==
"DTPRICEASOF")
101 else if (identifier ==
"CURRATE")
105 else if (identifier ==
"CURSYM")
109 else if (identifier ==
"CURRENCY")
113 else if (identifier ==
"ORIGCURRENCY")
117 else if (identifier ==
"MEMO")
121 else if (identifier ==
"INV401KSOURCE")
123 if (value ==
"PRETAX")
125 ASSIGN(data.inv_401k_source, data.OFX_401K_POSN_SOURCE_PRETAX);
127 else if (value ==
"AFTERTAX")
129 ASSIGN(data.inv_401k_source, data.OFX_401K_POSN_SOURCE_AFTERTAX);
131 else if (value ==
"MATCH")
133 ASSIGN(data.inv_401k_source, data.OFX_401K_POSN_SOURCE_MATCH);
135 else if (value ==
"PROFITSHARING")
137 ASSIGN(data.inv_401k_source, data.OFX_401K_POSN_SOURCE_PROFITSHARING);
139 else if (value ==
"ROLLOVER")
141 ASSIGN(data.inv_401k_source, data.OFX_401K_POSN_SOURCE_ROLLOVER);
143 else if (value ==
"OTHERVEST")
145 ASSIGN(data.inv_401k_source, data.OFX_401K_POSN_SOURCE_OTHERVEST);
147 else if (value ==
"OTHERNONVEST")
149 ASSIGN(data.inv_401k_source, data.OFX_401K_POSN_SOURCE_OTHERNONVEST);
160 if (data.unique_id_valid ==
true && MainContainer != NULL)
165 data.security_data_valid =
true;
168 libofx_context->positionCallback(data);
172 void OfxPositionContainer::add_account(
OfxAccountData * account_data)
174 if (account_data->account_id_valid ==
true)
183 if (MainContainer != NULL)
185 return MainContainer->add_container(
this);
A generic container for an OFX SGML element. Every container inherits from OfxGenericContainer.
virtual 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.
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.
Main header file containing the LibOfx API.
Message IO functionality.
LibOFX internal object code.
double ofxamount_to_double(const std::string ofxamount)
Convert OFX amount of money to double float.
time_t ofxdate_to_time_t(const std::string &ofxdate)
Convert a C++ string containing a time in OFX format to a C time_t.
Various simple functions for type conversion & al.
#define ASSIGN_STRNCPY(DEST, VALUE)
#define ASSIGN(DEST, VALUE)
An abstraction of an account.
char account_id[OFX_ACCOUNT_ID_LENGTH]
char currency[OFX_CURRENCY_LENGTH]
char memo[OFX_MEMO_LENGTH]
struct OfxSecurityData * security_data_ptr
struct OfxAccountData * account_ptr
char unique_id_type[OFX_UNIQUE_ID_TYPE_LENGTH]
int amounts_are_foreign_currency
char account_id[OFX_ACCOUNT_ID_LENGTH]
char unique_id[OFX_UNIQUE_ID_LENGTH]