00001 // Filename: softFilename.h 00002 // Created by: drose (10Nov00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #ifndef SOFTFILENAME_H 00020 #define SOFTFILENAME_H 00021 00022 #include <pandatoolbase.h> 00023 00024 //////////////////////////////////////////////////////////////////// 00025 // Class : SoftFilename 00026 // Description : This encapsulates a SoftImage versioned filename, of 00027 // the form base.v-v.ext: it consists of a directory 00028 // name, a base, a major and minor version number, and 00029 // an optional extension. 00030 // 00031 // It also keeps track of whether the named file has 00032 // been added to CVS, and how many scene files it is 00033 // referenced by, 00034 //////////////////////////////////////////////////////////////////// 00035 class SoftFilename { 00036 public: 00037 SoftFilename(const string &dirname, const string &filename); 00038 SoftFilename(const SoftFilename ©); 00039 void operator = (const SoftFilename ©); 00040 00041 const string &get_dirname() const; 00042 const string &get_filename() const; 00043 bool has_version() const; 00044 00045 string get_1_0_filename() const; 00046 00047 const string &get_base() const; 00048 int get_major() const; 00049 int get_minor() const; 00050 const string &get_extension() const; 00051 string get_non_extension() const; 00052 00053 bool is_1_0() const; 00054 void make_1_0(); 00055 00056 bool is_same_file(const SoftFilename &other) const; 00057 bool operator < (const SoftFilename &other) const; 00058 00059 void set_in_cvs(bool in_cvs); 00060 bool get_in_cvs() const; 00061 00062 void increment_use_count(); 00063 int get_use_count() const; 00064 00065 private: 00066 string _dirname; 00067 string _filename; 00068 bool _has_version; 00069 string _base; 00070 int _major; 00071 int _minor; 00072 string _ext; 00073 bool _in_cvs; 00074 int _use_count; 00075 }; 00076 00077 #endif