ofx_container_generic.cpp
Go to the documentation of this file.

    00001 /***************************************************************************
    00002          ofx_container_generic.cpp
    00003                              -------------------
    00004     copyright            : (C) 2002 by Benoit Gr�goire
    00005     email                : benoitg@coeus.ca
    00006 ***************************************************************************/
    00010 /***************************************************************************
    00011  *                                                                         *
    00012  *   This program is free software; you can redistribute it and/or modify  *
    00013  *   it under the terms of the GNU General Public License as published by  *
    00014  *   the Free Software Foundation; either version 2 of the License, or     *
    00015  *   (at your option) any later version.                                   *
    00016  *                                                                         *
    00017  ***************************************************************************/
    00018
    00019 #ifdef HAVE_CONFIG_H
    00020 #include <config.h>
    00021 #endif
    00022
    00023 #include <string>
    00024 #include "ParserEventGeneratorKit.h"
    00025 #include "messages.hh"
    00026 #include "libofx.h"
    00027 #include "ofx_containers.hh"
    00028
    00029 extern OfxMainContainer * MainContainer;
    00030
    00031 OfxGenericContainer::OfxGenericContainer(LibofxContext *p_libofx_context)
    00032 {
    00033   parentcontainer = NULL;
    00034   type = "";
    00035   tag_identifier = "";
    00036   libofx_context = p_libofx_context;
    00037 }
    00038 OfxGenericContainer::OfxGenericContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer)
    00039 {
    00040   libofx_context = p_libofx_context;
    00041   parentcontainer = para_parentcontainer;
    00042   if (parentcontainer != NULL && parentcontainer->type == "DUMMY")
    00043   {
    00044     message_out(DEBUG, "OfxGenericContainer(): The parent is a DummyContainer!");
    00045   }
    00046 }
    00047 OfxGenericContainer::OfxGenericContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, string para_tag_identifier)
    00048 {
    00049   libofx_context = p_libofx_context;
    00050   parentcontainer = para_parentcontainer;
    00051   tag_identifier = para_tag_identifier;
    00052   if (parentcontainer != NULL && parentcontainer->type == "DUMMY")
    00053   {
    00054     message_out(DEBUG, "OfxGenericContainer(): The parent for this " + tag_identifier + " is a DummyContainer!");
    00055   }
    00056 }
    00057 void OfxGenericContainer::add_attribute(const string identifier, const string value)
    00058 {
    00059   /*If an attribute has made it all the way up to the Generic Container's add_attribute,
    00060     we don't know what to do with it! */
    00061   message_out(ERROR, "WRITEME: " + identifier + " (" + value + ") is not supported by the " + type + " container");
    00062 }
    00063 OfxGenericContainer* OfxGenericContainer::getparent()
    00064 {
    00065   return parentcontainer;
    00066 }
    00067
    00068 int  OfxGenericContainer::gen_event()
    00069 {
    00070   /* No callback is ever generated for pure virtual containers */
    00071   return false;
    00072 }
    00073
    00074 int  OfxGenericContainer::add_to_main_tree()
    00075 {
    00076   if (MainContainer != NULL)
    00077   {
    00078     return MainContainer->add_container(this);
    00079   }
    00080   else
    00081   {
    00082     return false;
    00083   }
    00084 }
    00085