open_toontown_panda3d/panda/src/express/virtualFileSimple.h

85 lines
2.5 KiB
C++

// Filename: virtualFileSimple.h
// Created by: drose (03Aug02)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
//
// To contact the maintainers of this program write to
// panda3d-general@lists.sourceforge.net .
//
////////////////////////////////////////////////////////////////////
#ifndef VIRTUALFILESIMPLE_H
#define VIRTUALFILESIMPLE_H
#include "pandabase.h"
#include "virtualFile.h"
////////////////////////////////////////////////////////////////////
// Class : VirtualFileSimple
// Description : A simple file or directory within the
// VirtualFileSystem: this maps to exactly one file on
// one mount point. Most directories, and all regular
// files, are of this kind.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEXPRESS VirtualFileSimple : public VirtualFile {
public:
INLINE VirtualFileSimple(VirtualFileMount *mount,
const Filename &local_filename,
bool implicit_pz_file);
virtual VirtualFileSystem *get_file_system() const;
virtual Filename get_filename() const;
virtual bool is_directory() const;
virtual bool is_regular_file() const;
INLINE bool is_implicit_pz_file() const;
virtual istream *open_read_file(bool auto_unwrap) const;
virtual off_t get_file_size(istream *stream) const;
virtual off_t get_file_size() const;
virtual time_t get_timestamp() const;
protected:
virtual bool scan_local_directory(VirtualFileList *file_list,
const ov_set<string> &mount_points) const;
private:
VirtualFileMount *_mount;
Filename _local_filename;
bool _implicit_pz_file;
public:
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
PUBLISHED:
static TypeHandle get_class_type() {
return _type_handle;
}
public:
static void init_type() {
VirtualFile::init_type();
register_type(_type_handle, "VirtualFileSimple",
VirtualFile::get_class_type());
}
private:
static TypeHandle _type_handle;
};
#include "virtualFileSimple.I"
#endif