Bläddra i källkod

support HashFilename

David Rose 20 år sedan
förälder
incheckning
ff51585276

+ 10 - 0
dtool/src/dtoolutil/filename.I

@@ -206,6 +206,16 @@ operator [] (int n) const {
   return _filename[n];
   return _filename[n];
 }
 }
 
 
+////////////////////////////////////////////////////////////////////
+//     Function: Filename::substr
+//       Access: Published
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE string Filename::
+substr(size_t begin, size_t end) const {
+  return _filename.substr(begin, end);
+}
+
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: Filename::get_fullpath
 //     Function: Filename::get_fullpath

+ 5 - 5
dtool/src/dtoolutil/filename.cxx

@@ -1726,7 +1726,7 @@ make_dir() const {
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: Filename::locate_basename
 //     Function: Filename::locate_basename
-//       Access: Private
+//       Access: Protected
 //  Description: After the string has been reassigned, search for the
 //  Description: After the string has been reassigned, search for the
 //               slash marking the beginning of the basename, and set
 //               slash marking the beginning of the basename, and set
 //               _dirname_end and _basename_start correctly.
 //               _dirname_end and _basename_start correctly.
@@ -1778,7 +1778,7 @@ locate_basename() {
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: Filename::locate_extension
 //     Function: Filename::locate_extension
-//       Access: Private
+//       Access: Protected
 //  Description: Once the end of the directory prefix has been found,
 //  Description: Once the end of the directory prefix has been found,
 //               and _dirname_end and _basename_start are set
 //               and _dirname_end and _basename_start are set
 //               correctly, search for the dot marking the beginning
 //               correctly, search for the dot marking the beginning
@@ -1819,7 +1819,7 @@ locate_extension() {
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: Filename::get_common_prefix
 //     Function: Filename::get_common_prefix
-//       Access: Private
+//       Access: Protected
 //  Description: Returns the length of the longest common initial
 //  Description: Returns the length of the longest common initial
 //               substring of this string and the other one that ends
 //               substring of this string and the other one that ends
 //               in a slash.  This is the lowest directory common to
 //               in a slash.  This is the lowest directory common to
@@ -1845,7 +1845,7 @@ get_common_prefix(const string &other) const {
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: Filename::count_slashes
 //     Function: Filename::count_slashes
-//       Access: Private, Static
+//       Access: Protected, Static
 //  Description: Returns the number of non-consecutive slashes in the
 //  Description: Returns the number of non-consecutive slashes in the
 //               indicated string, not counting a terminal slash.
 //               indicated string, not counting a terminal slash.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
@@ -1880,7 +1880,7 @@ count_slashes(const string &str) {
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: Filename::r_make_canonical
 //     Function: Filename::r_make_canonical
-//       Access: Private
+//       Access: Protected
 //  Description: The recursive implementation of make_canonical().
 //  Description: The recursive implementation of make_canonical().
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 bool Filename::
 bool Filename::

+ 3 - 1
dtool/src/dtoolutil/filename.h

@@ -94,6 +94,8 @@ PUBLISHED:
   INLINE size_t length() const;
   INLINE size_t length() const;
   INLINE char operator [] (int n) const;
   INLINE char operator [] (int n) const;
 
 
+  INLINE string substr(size_t begin, size_t end = string::npos) const;
+
   // Or, you can use any of these.
   // Or, you can use any of these.
   INLINE string get_fullpath() const;
   INLINE string get_fullpath() const;
   INLINE string get_dirname() const;
   INLINE string get_dirname() const;
@@ -171,7 +173,7 @@ PUBLISHED:
 
 
   INLINE void output(ostream &out) const;
   INLINE void output(ostream &out) const;
 
 
-private:
+protected:
   void locate_basename();
   void locate_basename();
   void locate_extension();
   void locate_extension();
   size_t get_common_prefix(const string &other) const;
   size_t get_common_prefix(const string &other) const;