Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/mount_points/src/lib/graphics/importer/oif/object_information_file.cc @ 10239

Last change on this file since 10239 was 10239, checked in by patrick, 17 years ago

found a bug in the object information resources file. fixed

File size: 2.8 KB
Line 
1/*
2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004 orx
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
10
11   ### File Specific:
12   main-programmer: Patrick Boenzli patrick@orxonox.net
13   co-programmer:
14*/
15
16//#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_
17
18#include "object_information_file.h"
19
20#include "resource_oif.h"
21
22#include "util/loading/factory.h"
23#include "util/loading/load_param_xml.h"
24
25
26
27/**
28 * constructor
29 */
30OIFData::OIFData()
31{}
32
33
34/**
35 * constructor
36 * @param fileName name of the file
37 */
38OIFData::OIFData(const std::string& fileName)
39{
40  this->load(fileName);
41}
42
43
44/**
45 * loading the data
46 * @param fileName file name where the data can be found
47 */
48void OIFData::load(const std::string& fileName)
49{
50  //
51    if( fileName.empty())
52  {
53    PRINTF(3)("No filename specified for object information loading");
54    return;
55  }
56
57  TiXmlDocument XMLDoc(fileName);
58  // load the campaign document
59  if( !XMLDoc.LoadFile(fileName))
60  {
61    // report an error
62    PRINTF(3)("Could not load XML File %s: %s @ %d:%d\n", fileName.c_str(), XMLDoc.ErrorDesc(), XMLDoc.ErrorRow(), XMLDoc.ErrorCol());
63    return;
64  }
65
66  // check basic validity
67  this->_root = XMLDoc.RootElement();
68  assert( this->_root != NULL);
69
70  if( strcmp( this->_root->Value(), "ObjectInformationFile"))
71  {
72    // report an error
73    PRINTF(2)("Specified XML File is not an orxonox object information file (<ObjectInformationFile> element missing)\n");
74    return;
75  }
76
77}
78
79
80/**
81 * constructor
82 * @param fileName name of the file
83 */
84ObjectInformationFile::ObjectInformationFile()
85  : data(new OIFData())
86{
87  this->init();
88}
89
90/**
91 * constructor
92 * @param fileName name of the file
93 */
94ObjectInformationFile::ObjectInformationFile(const std::string& fileName)
95  : data(new OIFData(fileName))
96{
97  // load the oif file
98  this->data = ResourceOIF(fileName).data;
99
100  this->init();
101}
102
103
104/**
105 * copy constructor
106 * @param oif instance to copy from
107*/
108ObjectInformationFile::ObjectInformationFile(const ObjectInformationFile& oif)
109  :data(oif.data)
110{
111  this->init();
112}
113
114
115/**
116 * the definition of the assignment operator
117 * @param oif
118 * @return
119 */
120ObjectInformationFile& ObjectInformationFile::operator=(const ObjectInformationFile& oif)
121{
122  this->init();
123  this->data = oif.data;
124
125  return *this;
126}
127
128/**
129 * initizlizing function
130 */
131void ObjectInformationFile::init()
132{
133
134}
135
136
137/**
138 * standard deconstructor
139*/
140ObjectInformationFile::~ObjectInformationFile ()
141{
142  // delete what has to be deleted here
143}
144
145
146/**
147 * this initializes the mount point
148 * @param mountPoint to be initialized
149 */
150// void ObjectInformationFile::initMountPoint(MountPoint* mountPoint)
151// {
152//   TiXmlElement* root = this->data->root();
153//
154// }
155
Note: See TracBrowser for help on using the repository browser.