mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-11-04 00:26:39 +00:00 
			
		
		
		
	Added OGRE server prototype - NOT DONE
This commit is contained in:
		
							parent
							
								
									985e3847e0
								
							
						
					
					
						commit
						008b4c64aa
					
				
					 3 changed files with 97 additions and 1 deletions
				
			
		
							
								
								
									
										35
									
								
								stream/imp_server/ogre_datastream.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								stream/imp_server/ogre_datastream.h
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,35 @@
 | 
			
		|||
#ifndef MANGLE_STREAM_OGRESERVER_H
 | 
			
		||||
#define MANGLE_STREAM_OGRESERVER_H
 | 
			
		||||
 | 
			
		||||
#include <OgreDataStream.h>
 | 
			
		||||
 | 
			
		||||
namespace Mangle {
 | 
			
		||||
namespace Stream {
 | 
			
		||||
 | 
			
		||||
/** A Stream wrapping an OGRE DataStream.
 | 
			
		||||
 | 
			
		||||
    This has been built and tested against OGRE 1.6.2. You might have
 | 
			
		||||
    to make your own modifications if you're working with newer (or
 | 
			
		||||
    older) versions.
 | 
			
		||||
 */
 | 
			
		||||
class OgreStream : public InputStream
 | 
			
		||||
{
 | 
			
		||||
  Ogre::DataStreamPtr inp;
 | 
			
		||||
 | 
			
		||||
 public:
 | 
			
		||||
 OgreStream(Ogre::DataStreamPtr _inp) : inp(_inp)
 | 
			
		||||
  {
 | 
			
		||||
    isSeekable = true;
 | 
			
		||||
    hasPosition = true;
 | 
			
		||||
    hasSize = true;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  size_t read(void *buf, size_t count) { return inp->read(buf,count); }
 | 
			
		||||
  void seek(size_t pos) { inp->seek(pos); }
 | 
			
		||||
  size_t tell() const { return inp->tell(); }
 | 
			
		||||
  size_t size() const { return inp->size(); }
 | 
			
		||||
  bool eof() const { return inp->eof(); }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
}} // namespaces
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			@ -18,7 +18,6 @@ namespace VFS {
 | 
			
		|||
class MangleArchive : public Ogre::Archive, _Wrapper
 | 
			
		||||
{
 | 
			
		||||
 public:
 | 
			
		||||
  /// Constructor without name
 | 
			
		||||
  MangleArchive(VFS *vfs, const std::string &name,
 | 
			
		||||
                const std::string &archType = "Mangle",
 | 
			
		||||
                bool autoDel=false)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										62
									
								
								vfs/imp_server/ogre_vfs.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										62
									
								
								vfs/imp_server/ogre_vfs.h
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,62 @@
 | 
			
		|||
#ifndef MANGLE_VFS_OGRECLIENT_H
 | 
			
		||||
#define MANGLE_VFS_OGRECLIENT_H
 | 
			
		||||
 | 
			
		||||
#include <OgreArchive.h>
 | 
			
		||||
 | 
			
		||||
namespace Mangle {
 | 
			
		||||
namespace VFS {
 | 
			
		||||
 | 
			
		||||
/** @brief An interface into the OGRE VFS system.
 | 
			
		||||
 | 
			
		||||
    This class does not wrap a single Ogre::Archive, but rather the
 | 
			
		||||
    entire resource set available to Ogre. You can use this class to
 | 
			
		||||
    tap into all paths, Zip files, custom archives on so on that have
 | 
			
		||||
    been inserted into Ogre as resource locations.
 | 
			
		||||
 | 
			
		||||
    This class is currently a work in progres, it will not compile as
 | 
			
		||||
    it stands.
 | 
			
		||||
 | 
			
		||||
    This has been built and tested against OGRE 1.6.2. You might have
 | 
			
		||||
    to make your own modifications if you're working with newer (or
 | 
			
		||||
    older) versions.
 | 
			
		||||
 */
 | 
			
		||||
class OgreVFS : public VFS
 | 
			
		||||
{
 | 
			
		||||
 public:
 | 
			
		||||
  OgreVFS()
 | 
			
		||||
    {
 | 
			
		||||
      hasFind = true;
 | 
			
		||||
      isCaseSensitive = true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  /// Open a new data stream. Deleting the object should be enough to
 | 
			
		||||
  /// close it.
 | 
			
		||||
  virtual Stream::InputStream *open(const std::string &name);
 | 
			
		||||
 | 
			
		||||
  /// Check for the existence of a file
 | 
			
		||||
  virtual bool isFile(const std::string &name) const;
 | 
			
		||||
 | 
			
		||||
  /// Check for the existence of a directory
 | 
			
		||||
  virtual bool isDir(const std::string &name) const;
 | 
			
		||||
 | 
			
		||||
  /// Get info about a single file
 | 
			
		||||
  virtual FileInfo stat(const std::string &name) const;
 | 
			
		||||
 | 
			
		||||
  /// List all entries in a given directory. A blank dir should be
 | 
			
		||||
  /// interpreted as a the root/current directory of the archive. If
 | 
			
		||||
  /// dirs is true, list directories instead of files.
 | 
			
		||||
  virtual FileInfoList list(const std::string& dir = "",
 | 
			
		||||
                            bool recurse=true,
 | 
			
		||||
                            bool dirs=false) const;
 | 
			
		||||
 | 
			
		||||
  /// Find files after a given pattern. Wildcards (*) are
 | 
			
		||||
  /// supported. Only valid if 'hasFind' is true. Don't implement your
 | 
			
		||||
  /// own pattern matching here if the backend doesn't support it
 | 
			
		||||
  /// natively; use a filter instead (not implemented yet.)
 | 
			
		||||
  virtual FileInfoList find(const std::string& pattern,
 | 
			
		||||
                            bool recursive=true,
 | 
			
		||||
                            bool dirs=false) const;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
}} // namespaces
 | 
			
		||||
#endif
 | 
			
		||||
		Loading…
	
		Reference in a new issue