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, 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 string identifier, const 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 }
64 {
65  return parentcontainer;
66 }
67 
69 {
70  /* No callback is ever generated for pure virtual containers */
71  return false;
72 }
73 
75 {
76  if (MainContainer != NULL)
77  {
78  return MainContainer->add_container(this);
79  }
80  else
81  {
82  return false;
83  }
84 }
85 
OfxGenericContainer * getparent()
Returns the parent container object (the one representing the containing OFX SGML element) ...
A generic container for an OFX SGML element. Every container inherits from OfxGenericContainer.
virtual void add_attribute(const string identifier, const string value)
Add data to a container object.
int message_out(OfxMsgType error_type, const string message)
Message output function.
Definition: messages.cpp:61
virtual int add_to_main_tree()
Add this container to the main tree.
virtual int gen_event()
Generate libofx.h events.
LibOFX internal object code.
Message IO functionality.
The root container. Created by the <OFX> OFX element or by the export functions.