Panda3D
 All Classes Functions Variables Enumerations
softFilename.h
00001 // Filename: softFilename.h
00002 // Created by:  drose (10Nov00)
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 SOFTFILENAME_H
00016 #define SOFTFILENAME_H
00017 
00018 #include "pandatoolbase.h"
00019 
00020 ////////////////////////////////////////////////////////////////////
00021 //       Class : SoftFilename
00022 // Description : This encapsulates a SoftImage versioned filename, of
00023 //               the form base.v-v.ext: it consists of a directory
00024 //               name, a base, a major and minor version number, and
00025 //               an optional extension.
00026 //
00027 //               It also keeps track of whether the named file has
00028 //               been added to CVS, and how many scene files it is
00029 //               referenced by,
00030 ////////////////////////////////////////////////////////////////////
00031 class SoftFilename {
00032 public:
00033   SoftFilename(const string &dirname, const string &filename);
00034   SoftFilename(const SoftFilename &copy);
00035   void operator = (const SoftFilename &copy);
00036 
00037   const string &get_dirname() const;
00038   const string &get_filename() const;
00039   bool has_version() const;
00040 
00041   string get_1_0_filename() const;
00042 
00043   const string &get_base() const;
00044   int get_major() const;
00045   int get_minor() const;
00046   const string &get_extension() const;
00047   string get_non_extension() const;
00048 
00049   bool is_1_0() const;
00050   void make_1_0();
00051 
00052   bool is_same_file(const SoftFilename &other) const;
00053   bool operator < (const SoftFilename &other) const;
00054 
00055   void set_in_cvs(bool in_cvs);
00056   bool get_in_cvs() const;
00057 
00058   void set_wants_cvs(bool wants_cvs);
00059   bool get_wants_cvs() const;
00060 
00061   void increment_use_count();
00062   int get_use_count() const;
00063 
00064 private:
00065   string _dirname;
00066   string _filename;
00067   bool _has_version;
00068   string _base;
00069   int _major;
00070   int _minor;
00071   string _ext;
00072   bool _in_cvs;
00073   bool _wants_cvs;
00074   int _use_count;
00075 };
00076 
00077 #endif
 All Classes Functions Variables Enumerations