Orxonox  0.0.5 Codename: Arcturus
Resource.h
Go to the documentation of this file.
1 /*
2  * ORXONOX - the hottest 3D action shooter ever to exist
3  * > www.orxonox.net <
4  *
5  *
6  * License notice:
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  *
22  * Author:
23  * Reto Grieder
24  * Co-authors:
25  * ...
26  *
27  */
28 
39 #ifndef _Core_Resource_H__
40 #define _Core_Resource_H__
41 
42 #include "CorePrereqs.h"
43 
44 #include <memory>
45 
46 #include <OgreDataStream.h>
47 #include <OgreStringVector.h>
48 
49 namespace orxonox
50 {
51  // Import the Ogre::DataStreamList
52  using Ogre::DataStreamList;
53  using Ogre::DataStreamListPtr;
54  using Ogre::StringVector;
55  using Ogre::StringVectorPtr;
56 
58  struct ResourceInfo
59  {
69  size_t size;
72  };
73 
78  {
79  // Docs by Ogre::ResourceGroupManager.h
80  public:
93  static DataStreamPtr open(const std::string& name);
94 
96  static DataStreamPtr open(std::shared_ptr<ResourceInfo> fileInfo)
97  {
98  return open(fileInfo->filename);
99  }
100 
114  static DataStreamListPtr openMulti(const std::string& pattern);
115 
121  static bool exists(const std::string& name);
122 
128  static std::shared_ptr<ResourceInfo> getInfo(const std::string& name);
129 
137  static StringVectorPtr findResourceNames(const std::string& pattern);
138 
140  static const std::string& getDefaultResourceGroup();
141 
142  private:
143  // static class, no instances allowed:
144  Resource() = delete;
145  Resource(const Resource&) = delete;
146  Resource& operator=(const Resource&) = delete;
147  ~Resource() = delete;
148  };
149 }
150 
151 #endif /* _Core_Resource_H__ */
Stores basic information about a Resource from Ogre.
Definition: Resource.h:58
std::string path
Path name; separated by &#39;/&#39; and ending with &#39;/&#39;.
Definition: Resource.h:63
Shared library macros, enums, constants and forward declarations for the core library ...
::std::string string
Definition: gtest-port.h:756
std::string group
Resource group the file is in.
Definition: Resource.h:67
std::string basename
Base filename.
Definition: Resource.h:65
std::string fileSystemPath
Absolute file path ("" for files not on filesystem)
Definition: Resource.h:71
Provides simple functions to easily access the Ogre::ResourceGroupManager.
Definition: Resource.h:77
SharedPtr< DataStream > DataStreamPtr
Definition: CorePrereqs.h:365
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
#define _CoreExport
Definition: CorePrereqs.h:61
std::string filename
The file&#39;s fully qualified name.
Definition: Resource.h:61
static DataStreamPtr open(std::shared_ptr< ResourceInfo > fileInfo)
Similar to open(string, string, bool), but with a fileInfo struct.
Definition: Resource.h:96
size_t size
Uncompressed size.
Definition: Resource.h:69