Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/ogre_src_v1-9-0/OgreMain/include/OgreArchiveManager.h @ 148

Last change on this file since 148 was 148, checked in by patricwi, 6 years ago

Added new dependencies for ogre1.9 and cegui0.8

File size: 5.4 KB
Line 
1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4    (Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org/
6
7Copyright (c) 2000-2013 Torus Knot Software Ltd
8
9Permission is hereby granted, free of charge, to any person obtaining a copy
10of this software and associated documentation files (the "Software"), to deal
11in the Software without restriction, including without limitation the rights
12to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13copies of the Software, and to permit persons to whom the Software is
14furnished to do so, subject to the following conditions:
15
16The above copyright notice and this permission notice shall be included in
17all copies or substantial portions of the Software.
18
19THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25THE SOFTWARE.
26-----------------------------------------------------------------------------
27*/
28#ifndef _ArchiveManager_H__
29#define _ArchiveManager_H__
30
31#include "OgrePrerequisites.h"
32
33#include "OgreResourceManager.h"
34#include "OgreSingleton.h"
35#include "OgreHeaderPrefix.h"
36
37namespace Ogre {
38
39        /** \addtogroup Core
40        *  @{
41        */
42        /** \addtogroup Resources
43        *  @{
44        */
45    /** This class manages the available ArchiveFactory plugins.
46    */
47    class _OgreExport ArchiveManager : public Singleton<ArchiveManager>, public ArchiveAlloc
48    {
49    protected:
50        typedef map<String, ArchiveFactory*>::type ArchiveFactoryMap;
51        /// Factories available to create archives, indexed by archive type (String identifier e.g. 'Zip')
52        ArchiveFactoryMap mArchFactories;
53        /// Currently loaded archives
54        typedef map<String, Archive*>::type ArchiveMap;
55        ArchiveMap mArchives;
56
57    public:
58        /** Default constructor - should never get called by a client app.
59        */
60        ArchiveManager();
61        /** Default destructor.
62        */
63        virtual ~ArchiveManager();
64
65        /** Opens an archive for file reading.
66            @remarks
67                The archives are created using class factories within
68                extension libraries.
69            @param filename
70                The filename that will be opened
71            @param archiveType
72                The type of archive that this is. For example: "Zip".
73            @return
74                If the function succeeds, a valid pointer to an Archive
75                object is returned.
76            @par
77                If the function fails, an exception is thrown.
78        */
79        Archive* load( const String& filename, const String& archiveType, bool readOnly);
80
81                /** Unloads an archive.
82                @remarks
83                        You must ensure that this archive is not being used before removing it.
84                */
85                void unload(Archive* arch);
86                /** Unloads an archive by name.
87                @remarks
88                        You must ensure that this archive is not being used before removing it.
89                */
90                void unload(const String& filename);
91                typedef MapIterator<ArchiveMap> ArchiveMapIterator;
92                /** Get an iterator over the Archives in this Manager. */
93                ArchiveMapIterator getArchiveIterator(void);
94
95        /** Adds a new ArchiveFactory to the list of available factories.
96            @remarks
97                Plugin developers who add new archive codecs need to call
98                this after defining their ArchiveFactory subclass and
99                Archive subclasses for their archive type.
100        */
101        void addArchiveFactory(ArchiveFactory* factory);
102        /** Override standard Singleton retrieval.
103        @remarks
104        Why do we do this? Well, it's because the Singleton
105        implementation is in a .h file, which means it gets compiled
106        into anybody who includes it. This is needed for the
107        Singleton template to work, but we actually only want it
108        compiled into the implementation of the class based on the
109        Singleton, not all of them. If we don't change this, we get
110        link errors when trying to use the Singleton-based class from
111        an outside dll.
112        @par
113        This method just delegates to the template version anyway,
114        but the implementation stays in this single compilation unit,
115        preventing link errors.
116        */
117        static ArchiveManager& getSingleton(void);
118        /** Override standard Singleton retrieval.
119        @remarks
120        Why do we do this? Well, it's because the Singleton
121        implementation is in a .h file, which means it gets compiled
122        into anybody who includes it. This is needed for the
123        Singleton template to work, but we actually only want it
124        compiled into the implementation of the class based on the
125        Singleton, not all of them. If we don't change this, we get
126        link errors when trying to use the Singleton-based class from
127        an outside dll.
128        @par
129        This method just delegates to the template version anyway,
130        but the implementation stays in this single compilation unit,
131        preventing link errors.
132        */
133        static ArchiveManager* getSingletonPtr(void);
134    };
135        /** @} */
136        /** @} */
137
138}
139
140#include "OgreHeaderSuffix.h"
141
142#endif
Note: See TracBrowser for help on using the repository browser.