Panda3D
loaderFileType.h
1 // Filename: loaderFileType.h
2 // Created by: drose (20Jun00)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef LOADERFILETYPE_H
16 #define LOADERFILETYPE_H
17 
18 #include "pandabase.h"
19 
20 #include "typedObject.h"
21 #include "filename.h"
22 #include "pandaNode.h"
23 #include "pointerTo.h"
24 #include "dSearchPath.h"
25 
26 class LoaderOptions;
27 class BamCacheRecord;
28 
29 ////////////////////////////////////////////////////////////////////
30 // Class : LoaderFileType
31 // Description : This is the base class for a family of scene-graph
32 // file types that the Loader supports. Each kind of
33 // loader that's available should define a corresponding
34 // LoaderFileType object and register itself.
35 ////////////////////////////////////////////////////////////////////
36 class EXPCL_PANDA_PGRAPH LoaderFileType : public TypedObject {
37 protected:
39 
40 public:
41  virtual ~LoaderFileType();
42 
43 PUBLISHED:
44  virtual string get_name() const=0;
45  virtual string get_extension() const=0;
46  virtual string get_additional_extensions() const;
47  virtual bool supports_compressed() const;
48 
49  virtual bool get_allow_disk_cache(const LoaderOptions &options) const;
50  virtual bool get_allow_ram_cache(const LoaderOptions &options) const;
51 
52  virtual bool supports_load() const;
53  virtual bool supports_save() const;
54 
55 public:
56  virtual PT(PandaNode) load_file(const Filename &path, const LoaderOptions &options,
57  BamCacheRecord *record) const;
58  virtual bool save_file(const Filename &path, const LoaderOptions &options,
59  PandaNode *node) const;
60 
61 protected:
62  int _no_cache_flags;
63 
64 public:
65  static TypeHandle get_class_type() {
66  return _type_handle;
67  }
68  static void init_type() {
70  register_type(_type_handle, "LoaderFileType",
71  TypedObject::get_class_type());
72  }
73  virtual TypeHandle get_type() const {
74  return get_class_type();
75  }
76  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
77 
78 private:
79  static TypeHandle _type_handle;
80 };
81 
82 #endif
83 
A basic node of the scene graph or data graph.
Definition: pandaNode.h:72
static void init_type()
This function is declared non-inline to work around a compiler bug in g++ 2.96.
Definition: typedObject.cxx:52
Specifies parameters that may be passed to the loader.
Definition: loaderOptions.h:26
This is an abstract class that all classes which use TypeHandle, and also provide virtual functions t...
Definition: typedObject.h:98
The name of a file, such as a texture file or an Egg file.
Definition: filename.h:44
An instance of this class is written to the front of a Bam or Txo file to make the file a cached inst...
This is the base class for a family of scene-graph file types that the Loader supports.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85