/* orxonox - the future of 3D-vertical-scrollers Copyright (C) 2004 orx This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. ### File Specific: main-programmer: Patrick Boenzli patrick@orxonox.net co-programmer: */ //#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_ #include "object_information_file.h" #include "resource_oif.h" #include "util/loading/factory.h" #include "util/loading/load_param_xml.h" /** * constructor * @param fileName name of the file */ OIFData::OIFData(const std::string& fileName) { this->load(fileName); } /** * loading the data * @param fileName file name where the data can be found */ void OIFData::load(const std::string& fileName) { // if( fileName.empty()) { PRINTF(3)("No filename specified for object information loading"); return; } TiXmlDocument XMLDoc(fileName); // load the campaign document if( !XMLDoc.LoadFile(fileName)) { // report an error PRINTF(3)("Could not load XML File %s: %s @ %d:%d\n", fileName.c_str(), XMLDoc.ErrorDesc(), XMLDoc.ErrorRow(), XMLDoc.ErrorCol()); return; } // check basic validity TiXmlElement* root = XMLDoc.RootElement(); assert( root != NULL); if( strcmp( root->Value(), "ObjectInformationFile")) { // report an error PRINTF(2)("Specified XML File is not an orxonox object information file ( element missing)\n"); return; } // construct campaign // return new Campaign( root); } /** * standard constructor */ ObjectInformationFile::ObjectInformationFile() { this->init(); } /** * constructor * @param fileName name of the file */ ObjectInformationFile::ObjectInformationFile(const std::string& fileName) : data(new OIFData(fileName)) { // load the oif file this->data = ResourceOIF(fileName).data; this->init(); } /** * copy constructor * @param oif instance to copy from */ ObjectInformationFile::ObjectInformationFile(const ObjectInformationFile& oif) :data(oif.data) { this->init(); } /** * initizlizing function */ void ObjectInformationFile::init() { } /** * standard deconstructor */ ObjectInformationFile::~ObjectInformationFile () { // delete what has to be deleted here } ObjectInformationFile& ObjectInformationFile::operator=(const ObjectInformationFile& oif) { this->data = oif.data; return *this; }