/usr/include/OGRE/OgreArchive.h is in libogre-1.9-dev 1.9.0+dfsg1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | /*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/
Copyright (c) 2000-2013 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
#ifndef _Archive_H__
#define _Archive_H__
#include "OgrePrerequisites.h"
#include "OgreString.h"
#include "OgreDataStream.h"
#include "OgreSharedPtr.h"
#include "OgreStringVector.h"
#include "OgreException.h"
#include <ctime>
#include "OgreHeaderPrefix.h"
namespace Ogre {
/** \addtogroup Core
* @{
*/
/** \addtogroup Resources
* @{
*/
/** Information about a file/directory within the archive will be
returned using a FileInfo struct.
@see
Archive
*/
struct FileInfo {
/// The archive in which the file has been found (for info when performing
/// multi-Archive searches, note you should still open through ResourceGroupManager)
const Archive* archive;
/// The file's fully qualified name
String filename;
/// Path name; separated by '/' and ending with '/'
String path;
/// Base filename
String basename;
/// Compressed size
size_t compressedSize;
/// Uncompressed size
size_t uncompressedSize;
};
typedef vector<FileInfo>::type FileInfoList;
typedef SharedPtr<FileInfoList> FileInfoListPtr;
/** Archive-handling class.
@remarks
An archive is a generic term for a container of files. This may be a
filesystem folder, it may be a compressed archive, it may even be
a remote location shared on the web. This class is designed to be
subclassed to provide access to a range of file locations.
@par
Instances of this class are never constructed or even handled by end-user
applications. They are constructed by custom ArchiveFactory classes,
which plugins can register new instances of using ArchiveManager.
End-user applications will typically use ResourceManager or
ResourceGroupManager to manage resources at a higher level, rather than
reading files directly through this class. Doing it this way allows you
to benefit from OGRE's automatic searching of multiple file locations
for the resources you are looking for.
*/
class _OgreExport Archive : public ArchiveAlloc
{
protected:
/// Archive name
String mName;
/// Archive type code
String mType;
/// Read-only flag
bool mReadOnly;
public:
/** Constructor - don't call direct, used by ArchiveFactory.
*/
Archive( const String& name, const String& archType )
: mName(name), mType(archType), mReadOnly(true) {}
/** Default destructor.
*/
virtual ~Archive() {}
/// Get the name of this archive
const String& getName(void) const { return mName; }
/// Returns whether this archive is case sensitive in the way it matches files
virtual bool isCaseSensitive(void) const = 0;
/** Loads the archive.
@remarks
This initializes all the internal data of the class.
@warning
Do not call this function directly, it is meant to be used
only by the ArchiveManager class.
*/
virtual void load() = 0;
/** Unloads the archive.
@warning
Do not call this function directly, it is meant to be used
only by the ArchiveManager class.
*/
virtual void unload() = 0;
/** Reports whether this Archive is read-only, or whether the contents
can be updated.
*/
virtual bool isReadOnly() const { return mReadOnly; }
/** Open a stream on a given file.
@note
There is no equivalent 'close' method; the returned stream
controls the lifecycle of this file operation.
@param filename The fully qualified name of the file
@param readOnly Whether to open the file in read-only mode or not (note,
if the archive is read-only then this cannot be set to false)
@return A shared pointer to a DataStream which can be used to
read / write the file. If the file is not present, returns a null
shared pointer.
*/
virtual DataStreamPtr open(const String& filename, bool readOnly = true) const = 0;
/** Create a new file (or overwrite one already there).
@note If the archive is read-only then this method will fail.
@param filename The fully qualified name of the file
@return A shared pointer to a DataStream which can be used to
read / write the file.
*/
virtual DataStreamPtr create(const String& filename) const
{
(void)filename;
OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED,
"This archive does not support creation of files.",
"Archive::create");
}
/** Delete a named file.
@remarks Not possible on read-only archives
@param filename The fully qualified name of the file
*/
virtual void remove(const String& filename) const
{
(void)filename;
OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED,
"This archive does not support removal of files.",
"Archive::remove");
}
/** List all file names in the archive.
@note
This method only returns filenames, you can also retrieve other
information using listFileInfo.
@param recursive Whether all paths of the archive are searched (if the
archive has a concept of that)
@param dirs Set to true if you want the directories to be listed
instead of files
@return A list of filenames matching the criteria, all are fully qualified
*/
virtual StringVectorPtr list(bool recursive = true, bool dirs = false) = 0;
/** List all files in the archive with accompanying information.
@param recursive Whether all paths of the archive are searched (if the
archive has a concept of that)
@param dirs Set to true if you want the directories to be listed
instead of files
@return A list of structures detailing quite a lot of information about
all the files in the archive.
*/
virtual FileInfoListPtr listFileInfo(bool recursive = true, bool dirs = false) = 0;
/** Find all file or directory names matching a given pattern
in this archive.
@note
This method only returns filenames, you can also retrieve other
information using findFileInfo.
@param pattern The pattern to search for; wildcards (*) are allowed
@param recursive Whether all paths of the archive are searched (if the
archive has a concept of that)
@param dirs Set to true if you want the directories to be listed
instead of files
@return A list of filenames matching the criteria, all are fully qualified
*/
virtual StringVectorPtr find(const String& pattern, bool recursive = true,
bool dirs = false) = 0;
/** Find out if the named file exists (note: fully qualified filename required) */
virtual bool exists(const String& filename) = 0;
/** Retrieve the modification time of a given file */
virtual time_t getModifiedTime(const String& filename) = 0;
/** Find all files or directories matching a given pattern in this
archive and get some detailed information about them.
@param pattern The pattern to search for; wildcards (*) are allowed
@param recursive Whether all paths of the archive are searched (if the
archive has a concept of that)
@param dirs Set to true if you want the directories to be listed
instead of files
@return A list of file information structures for all files matching
the criteria.
*/
virtual FileInfoListPtr findFileInfo(const String& pattern,
bool recursive = true, bool dirs = false) const = 0;
/// Return the type code of this Archive
const String& getType(void) const { return mType; }
};
/** @} */
/** @} */
}
#include "OgreHeaderSuffix.h"
#endif
|