25#include "ParserEventGeneratorKit.h"
38OfxMainContainer::~OfxMainContainer()
43 while (tmp != security_tree.end())
49 tmp = account_tree.begin();
50 while (tmp != account_tree.end())
62 if (container !=
this) {
71 security_tree.insert(security_tree.begin(), container);
80 if ( account_tree.size() == 0)
82 message_out(
DEBUG,
"OfxMainContainer::add_container, account is the first account");
83 account_tree.insert(account_tree.begin(), container);
87 message_out(
DEBUG,
"OfxMainContainer::add_container, account is not the first account");
88 tree<OfxGenericContainer *>::sibling_iterator tmp = account_tree.begin();
89 tmp += (account_tree.number_of_siblings(tmp));
90 account_tree.insert_after(tmp, container);
98 tree<OfxGenericContainer *>::sibling_iterator tmp = account_tree.begin();
100 tmp += (account_tree.number_of_siblings(tmp));
102 if (account_tree.is_valid(tmp))
106 if (account_tree.number_of_children(tmp) != 0)
109 account_tree.insert(tmp.begin(), container);
115 account_tree.append_child(tmp, container);
117 container->add_account(&( ((OfxAccountContainer *)(*tmp))->data));
122 message_out(
ERROR,
"OfxMainContainer::add_container, no accounts are present (tmp is invalid)");
129 message_out(
DEBUG,
"OfxMainContainer::add_container, adding a transaction");
131 if ( account_tree.size() != 0)
133 tree<OfxGenericContainer *>::sibling_iterator tmp = account_tree.begin();
135 tmp += (account_tree.number_of_siblings(tmp));
136 if (account_tree.is_valid(tmp))
138 message_out(
DEBUG,
"OfxMainContainer::add_container: tmp is valid, Accounts are present");
139 account_tree.append_child(tmp, container);
140 container->add_account(&(((OfxAccountContainer *)(*tmp))->data));
160 if ( account_tree.size() != 0)
162 tree<OfxGenericContainer *>::sibling_iterator tmp = account_tree.begin();
164 tmp += (account_tree.number_of_siblings(tmp));
165 if (account_tree.is_valid(tmp))
167 message_out(
DEBUG,
"OfxMainContainer::add_container: tmp is valid, Accounts are present");
168 account_tree.append_child(tmp, container);
169 container->add_account(&(((OfxAccountContainer *)(*tmp))->data));
187 message_out(
DEBUG,
"Begin walking the trees of the main container to generate events");
191 while (tmp != security_tree.end())
199 tmp = account_tree.begin();
202 while (tmp != account_tree.end())
209 message_out(
DEBUG,
"End walking the trees of the main container to generate events");
214OfxSecurityData * OfxMainContainer::find_security(std::string unique_id)
219 OfxSecurityData * retval = NULL;
220 while (tmp != security_tree.
end() && retval == NULL)
Represents a bank account or a credit card account.
A generic container for an OFX SGML element. Every container inherits from OfxGenericContainer.
std::string tag_identifier
virtual int gen_event()
Generate libofx.h events.
int gen_event()
Generate libofx.h events.
Represents an investment position, such as a stock or bond.
Represents a security, such as a stock or bond.
Represents a statement for either a bank account or a credit card account.
Represents a generic transaction.
Iterator which traverses only the nodes which are siblings of each other.
pre_order_iterator iterator
The default iterator type throughout the tree class.
pre_order_iterator begin() const
Return iterator to the beginning of the tree.
pre_order_iterator end() const
Return iterator to the end of the tree.
int message_out(OfxMsgType error_type, const std::string message)
Message output function.
Message IO functionality.
LibOFX internal object code.