# 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                : bock@step.polymtl.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     message_out(DEBUG,"OfxGenericContainer(): The parent is a DummyContainer!");
    00044   }
    00045 }
    00046 OfxGenericContainer::OfxGenericContainer(LibofxContext *p_libofx_context, OfxGenericContainer *para_parentcontainer, string para_tag_identifier)
    00047 {
    00048   libofx_context = p_libofx_context;
    00049   parentcontainer = para_parentcontainer;
    00050   tag_identifier = para_tag_identifier;
    00051   if(parentcontainer!=NULL&&parentcontainer->type=="DUMMY"){
    00052     message_out(DEBUG,"OfxGenericContainer(): The parent for this "+tag_identifier+" is a DummyContainer!");
    00053   }
    00054 }
    00055 void OfxGenericContainer::add_attribute(const string identifier, const string value)
    00056 {
    00057   /*If an attribute has made it all the way up to the Generic Container's add_attribute,
    00058     we don't know what to do with it! */
    00059     message_out(ERROR, "WRITEME: "+identifier+" ("+value+") is not supported by the "+type+" container");
    00060 }
    00061 OfxGenericContainer* OfxGenericContainer::getparent()
    00062 {
    00063   return parentcontainer;
    00064 }
    00065
    00066 int  OfxGenericContainer::gen_event()
    00067 {
    00068   /* No callback is ever generated for pure virtual containers */
    00069   return false;
    00070 }
    00071
    00072 int  OfxGenericContainer::add_to_main_tree()
    00073 {
    00074   if(MainContainer != NULL)
    00075     {
    00076       return MainContainer->add_container(this);
    00077     }
    00078   else
    00079     {
    00080       return false;
    00081     }
    00082 }
    00083