LibOFX: ofx_container_generic.cpp Source File

LibOFX

ofx_container_generic.cpp
Go to the documentation of this file.
1 /***************************************************************************
2 ofx_container_generic.cpp
3 -------------------
4 copyright : (C) 2002 by Benoit Gr�goire
5 email : benoitg@coeus.ca
6 ***************************************************************************/
10 /***************************************************************************
11 * *
12 * This program is free software; you can redistribute it and/or modify *
13 * it under the terms of the GNU General Public License as published by *
14 * the Free Software Foundation; either version 2 of the License, or *
15 * (at your option) any later version. *
16 * *
17 ***************************************************************************/
18
19 #ifdef HAVE_CONFIG_H
20 #include <config.h>
21 #endif
22
23 #include <string>
24 #include "ParserEventGeneratorKit.h"
25 #include "messages.hh"
26 #include "libofx.h"
27 #include "ofx_containers.hh"
28
29 extern OfxMainContainer * MainContainer;
30
31 OfxGenericContainer::OfxGenericContainer(LibofxContext *p_libofx_context)
32 {
33 parentcontainer = NULL;
34 type = "";
35 tag_identifier = "";
36 libofx_context = p_libofx_context;
37 }
38 OfxGenericContainer::OfxGenericContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer)
39 {
40 libofx_context = p_libofx_context;
41 parentcontainer = para_parentcontainer;
42 if (parentcontainer != NULL && parentcontainer->type == "DUMMY")
43 {
44 message_out(DEBUG, "OfxGenericContainer(): The parent is a DummyContainer!");
45 }
46 }
47 OfxGenericContainer::OfxGenericContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, std::string para_tag_identifier)
48 {
49 libofx_context = p_libofx_context;
50 parentcontainer = para_parentcontainer;
51 tag_identifier = para_tag_identifier;
52 if (parentcontainer != NULL && parentcontainer->type == "DUMMY")
53 {
54 message_out(DEBUG, "OfxGenericContainer(): The parent for this " + tag_identifier + " is a DummyContainer!");
55 }
56 }
57 void OfxGenericContainer::add_attribute(const std::string identifier, const std::string value)
58 {
59 /*If an attribute has made it all the way up to the Generic Container's add_attribute,
60 we don't know what to do with it! */
61 message_out(ERROR, "WRITEME: " + identifier + " (" + value + ") is not supported by the " + type + " container");
62 }
63 OfxGenericContainer* OfxGenericContainer::getparent()
64 {
65 return parentcontainer;
66 }
67
68 int OfxGenericContainer::gen_event()
69 {
70 /* No callback is ever generated for pure virtual containers */
71 return false;
72 }
73
74 int OfxGenericContainer::add_to_main_tree()
75 {
76 if (MainContainer != NULL)
77 {
78 return MainContainer->add_container(this);
79 }
80 else
81 {
82 return false;
83 }
84 }
85
OfxGenericContainer::type
std::string type
Definition: ofx_containers.hh:41
OfxMainContainer
The root container. Created by the <OFX> OFX element or by the export functions.
Definition: ofx_containers.hh:289
OfxGenericContainer::gen_event
virtual int gen_event()
Generate libofx.h events.
Definition: ofx_container_generic.cpp:68
ERROR
@ ERROR
Definition: messages.hh:41
OfxGenericContainer
A generic container for an OFX SGML element. Every container inherits from OfxGenericContainer.
Definition: ofx_containers.hh:31
OfxGenericContainer::add_attribute
virtual void add_attribute(const std::string identifier, const std::string value)
Add data to a container object.
Definition: ofx_container_generic.cpp:57
LibofxContext
Definition: context.hh:23
ofx_containers.hh
LibOFX internal object code.
message_out
int message_out(OfxMsgType error_type, const std::string message)
Message output function.
Definition: messages.cpp:67
OfxGenericContainer::getparent
OfxGenericContainer * getparent()
Returns the parent container object (the one representing the containing OFX SGML element)
Definition: ofx_container_generic.cpp:63
messages.hh
Message IO functionality.
OfxGenericContainer::tag_identifier
std::string tag_identifier
Definition: ofx_containers.hh:42
DEBUG
@ DEBUG
Definition: messages.hh:32
OfxGenericContainer::add_to_main_tree
virtual int add_to_main_tree()
Add this container to the main tree.
Definition: ofx_container_generic.cpp:74