00001 // Filename: globPattern.I 00002 // Created by: drose (30May00) 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 00020 //////////////////////////////////////////////////////////////////// 00021 // Function: GlobPattern::Constructor 00022 // Access: Public 00023 // Description: 00024 //////////////////////////////////////////////////////////////////// 00025 INLINE GlobPattern:: 00026 GlobPattern(const string &pattern) : _pattern(pattern) { 00027 } 00028 00029 //////////////////////////////////////////////////////////////////// 00030 // Function: GlobPattern::Copy Constructor 00031 // Access: Public 00032 // Description: 00033 //////////////////////////////////////////////////////////////////// 00034 INLINE GlobPattern:: 00035 GlobPattern(const GlobPattern ©) : _pattern(copy._pattern) { 00036 } 00037 00038 //////////////////////////////////////////////////////////////////// 00039 // Function: GlobPattern::Copy Assignment Operator 00040 // Access: Public 00041 // Description: 00042 //////////////////////////////////////////////////////////////////// 00043 INLINE void GlobPattern:: 00044 operator = (const GlobPattern ©) { 00045 _pattern = copy._pattern; 00046 } 00047 00048 //////////////////////////////////////////////////////////////////// 00049 // Function: GlobPattern::set_pattern 00050 // Access: Public 00051 // Description: Changes the pattern string that the GlobPattern 00052 // object matches. 00053 //////////////////////////////////////////////////////////////////// 00054 INLINE void GlobPattern:: 00055 set_pattern(const string &pattern) { 00056 _pattern = pattern; 00057 } 00058 00059 //////////////////////////////////////////////////////////////////// 00060 // Function: GlobPattern::get_pattern 00061 // Access: Public 00062 // Description: Returns the pattern string that the GlobPattern 00063 // object matches. 00064 //////////////////////////////////////////////////////////////////// 00065 INLINE const string &GlobPattern:: 00066 get_pattern() const { 00067 return _pattern; 00068 } 00069 00070 //////////////////////////////////////////////////////////////////// 00071 // Function: GlobPattern::matches 00072 // Access: Public 00073 // Description: Returns true if the candidate string matches the 00074 // pattern, false otherwise. 00075 //////////////////////////////////////////////////////////////////// 00076 INLINE bool GlobPattern:: 00077 matches(const string &candidate) const { 00078 return matches_substr(_pattern.begin(), _pattern.end(), 00079 candidate.begin(), candidate.end()); 00080 } 00081 00082 //////////////////////////////////////////////////////////////////// 00083 // Function: GlobPattern::output 00084 // Access: Public 00085 // Description: 00086 //////////////////////////////////////////////////////////////////// 00087 INLINE void GlobPattern:: 00088 output(ostream &out) const { 00089 out << _pattern; 00090 }