Panda3D

eggFilenameNode.h

00001 // Filename: eggFilenameNode.h
00002 // Created by:  drose (11Feb99)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #ifndef EGGFILENAMENODE_H
00016 #define EGGFILENAMENODE_H
00017 
00018 #include "pandabase.h"
00019 
00020 #include "eggNode.h"
00021 #include "filename.h"
00022 
00023 ////////////////////////////////////////////////////////////////////
00024 //       Class : EggFilenameNode
00025 // Description : This is an egg node that contains a filename.  It
00026 //               references a physical file relative to the directory
00027 //               the egg file was loaded in.  It is a base class for
00028 //               EggTexture and EggExternalReference.
00029 ////////////////////////////////////////////////////////////////////
00030 class EXPCL_PANDAEGG EggFilenameNode : public EggNode {
00031 PUBLISHED:
00032   INLINE EggFilenameNode();
00033   INLINE EggFilenameNode(const string &node_name, const Filename &filename);
00034   INLINE EggFilenameNode(const EggFilenameNode &copy);
00035   INLINE EggFilenameNode &operator = (const EggFilenameNode &copy);
00036 
00037   virtual string get_default_extension() const;
00038 
00039   INLINE const Filename &get_filename() const;
00040   INLINE void set_filename(const Filename &filename);
00041 
00042   INLINE const Filename &get_fullpath() const;
00043   INLINE void set_fullpath(const Filename &fullpath);
00044 
00045 public:
00046   class IndirectOrderByBasename {
00047   public:
00048     bool operator () (const EggFilenameNode *a, const EggFilenameNode *b) const {
00049       return a->get_filename().get_basename() < b->get_filename().get_basename();
00050     }
00051   };
00052 
00053 protected:
00054   Filename _filename;
00055   Filename _fullpath;
00056 
00057 public:
00058   static TypeHandle get_class_type() {
00059     return _type_handle;
00060   }
00061   static void init_type() {
00062     EggNode::init_type();
00063     register_type(_type_handle, "EggFilenameNode",
00064                   EggNode::get_class_type());
00065   }
00066   virtual TypeHandle get_type() const {
00067     return get_class_type();
00068   }
00069   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00070 
00071 private:
00072   static TypeHandle _type_handle;
00073 };
00074 
00075 #include "eggFilenameNode.I"
00076 
00077 #endif
 All Classes Functions Variables Enumerations