Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 13, 2006, 11:19:25 AM (18 years ago)
Author:
patrick
Message:

oif is a xml file, loading precedures implemented

Location:
branches/mount_points/src/lib/graphics/importer/oif
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/mount_points/src/lib/graphics/importer/oif/object_information_file.cc

    r10059 r10060  
    2020#include "resource_oif.h"
    2121
     22#include "util/loading/factory.h"
     23#include "util/loading/load_param_xml.h"
     24
     25
     26/**
     27 * constructor
     28 * @param fileName name of the file
     29 */
     30OIFData::OIFData(const std::string& fileName)
     31{
     32  this->load(fileName);
     33}
     34
     35
     36/**
     37 * loading the data
     38 * @param fileName file name where the data can be found
     39 */
     40void OIFData::load(const std::string& fileName)
     41{
     42  //
     43    if( fileName.empty())
     44  {
     45    PRINTF(3)("No filename specified for object information loading");
     46    return;
     47  }
     48
     49  TiXmlDocument XMLDoc(fileName);
     50  // load the campaign document
     51  if( !XMLDoc.LoadFile(fileName))
     52  {
     53    // report an error
     54    PRINTF(3)("Could not load XML File %s: %s @ %d:%d\n", fileName.c_str(), XMLDoc.ErrorDesc(), XMLDoc.ErrorRow(), XMLDoc.ErrorCol());
     55    return;
     56  }
     57
     58  // check basic validity
     59  TiXmlElement* root = XMLDoc.RootElement();
     60  assert( root != NULL);
     61
     62  if( strcmp( root->Value(), "ObjectInformationFile"))
     63  {
     64    // report an error
     65    PRINTF(2)("Specified XML File is not an orxonox object information file (<ObjectInformationFile> element missing)\n");
     66    return;
     67  }
     68
     69  // construct campaign
     70//   return new Campaign( root);
     71}
     72
    2273
    2374
     
    3586 */
    3687ObjectInformationFile::ObjectInformationFile(const std::string& fileName)
    37   : data(new OIFData())
     88  : data(new OIFData(fileName))
    3889{
    3990  // load the oif file
  • branches/mount_points/src/lib/graphics/importer/oif/object_information_file.h

    r10054 r10060  
    1818  typedef CountPointer<OIFData>    Pointer;
    1919
     20
    2021public:
    21   OIFData() {}
     22  OIFData(const std::string& fileName);
    2223  virtual ~OIFData() {}
    2324
     25  void load(const std::string& fileName);
    2426
    2527
Note: See TracChangeset for help on using the changeset viewer.