Panda3D
eggFilenameNode.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file eggFilenameNode.h
10  * @author drose
11  * @date 1999-02-11
12  */
13 
14 #ifndef EGGFILENAMENODE_H
15 #define EGGFILENAMENODE_H
16 
17 #include "pandabase.h"
18 
19 #include "eggNode.h"
20 #include "filename.h"
21 
22 /**
23  * This is an egg node that contains a filename. It references a physical
24  * file relative to the directory the egg file was loaded in. It is a base
25  * class for EggTexture and EggExternalReference.
26  */
27 class EXPCL_PANDA_EGG EggFilenameNode : public EggNode {
28 PUBLISHED:
29  INLINE EggFilenameNode();
30  INLINE explicit EggFilenameNode(const std::string &node_name, const Filename &filename);
31  INLINE EggFilenameNode(const EggFilenameNode &copy);
32  INLINE EggFilenameNode &operator = (const EggFilenameNode &copy);
33 
34  virtual std::string get_default_extension() const;
35 
36  INLINE const Filename &get_filename() const;
37  INLINE void set_filename(const Filename &filename);
38 
39  INLINE const Filename &get_fullpath() const;
40  INLINE void set_fullpath(const Filename &fullpath);
41 
42 public:
44  public:
45  bool operator () (const EggFilenameNode *a, const EggFilenameNode *b) const {
46  return a->get_filename().get_basename() < b->get_filename().get_basename();
47  }
48  };
49 
50 protected:
51  Filename _filename;
52  Filename _fullpath;
53 
54 public:
55  static TypeHandle get_class_type() {
56  return _type_handle;
57  }
58  static void init_type() {
59  EggNode::init_type();
60  register_type(_type_handle, "EggFilenameNode",
61  EggNode::get_class_type());
62  }
63  virtual TypeHandle get_type() const {
64  return get_class_type();
65  }
66  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
67 
68 private:
69  static TypeHandle _type_handle;
70 };
71 
72 #include "eggFilenameNode.I"
73 
74 #endif
const Filename & get_filename() const
Returns a nonmodifiable reference to the filename.
This is an egg node that contains a filename.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition: register_type.I:22
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
The name of a file, such as a texture file or an Egg file.
Definition: filename.h:39
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
std::string get_basename() const
Returns the basename part of the filename.
Definition: filename.I:367
A base class for things that may be directly added into the egg hierarchy.
Definition: eggNode.h:35
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81