Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/mount_points/src/lib/graphics/importer/oif/resource_oif.cc @ 10241

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

much more on the resources. it's not that simple at all

File size: 1.7 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#include "resource_oif.h"
17
18#include "substring.h"
19#include "multi_type.h"
20#include "debug.h"
21
22
23ResourceOIF::ResourceOIF(const std::string& fileName, const Resources::KeepLevel& keepLevel)
24    : Resource(&ResourceOIF::type)
25{
26  Resources::StorePointer* ptr = this->acquireResource(fileName);
27
28
29  if (ptr)
30  {
31    PRINTF(5)("FOUND OIF: %s\n", fileName.c_str());
32    this->acquireData(static_cast<ResourceOIF::OIFResourcePointer*>(ptr)->ptr());
33  }
34  else
35  {
36    PRINTF(5)("NOT FOUND OIF: %s\n", fileName.c_str());
37    std::string fullName = this->Resource::locateFile(fileName);
38
39    this->ObjectInformationFile::load(fileName);
40    this->Resource::addResource(new ResourceOIF::OIFResourcePointer(fileName, keepLevel, this->ObjectInformationFile::dataPointer()));
41  }
42
43}
44
45ResourceOIF ResourceOIF::createFromString(const std::string& loadString, const Resources::KeepLevel& keepLevel)
46{
47  SubString loadValues(loadString, ',');
48  std::string fileName;
49  if (loadValues.size() > 0)
50    fileName = loadValues[0];
51
52  return ResourceOIF(fileName);
53}
54
55
56
57Resources::tType<ResourceOIF> ResourceOIF::type("OIF");
58
59
60
61
62
63ResourceOIF::OIFResourcePointer::OIFResourcePointer(const std::string& loadString, const Resources::KeepLevel& keepLevel, const OIFData::Pointer& data)
64    : Resources::StorePointer(loadString, keepLevel) , pointer(data)
65{}
66
67
Note: See TracBrowser for help on using the repository browser.