2
0

globPattern.I 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. // Filename: globPattern.I
  2. // Created by: drose (30May00)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) Carnegie Mellon University. All rights reserved.
  8. //
  9. // All use of this software is subject to the terms of the revised BSD
  10. // license. You should have received a copy of this license along
  11. // with this source code in a file named "LICENSE."
  12. //
  13. ////////////////////////////////////////////////////////////////////
  14. ////////////////////////////////////////////////////////////////////
  15. // Function: GlobPattern::Constructor
  16. // Access: Public
  17. // Description:
  18. ////////////////////////////////////////////////////////////////////
  19. INLINE GlobPattern::
  20. GlobPattern(const string &pattern) : _pattern(pattern) {
  21. }
  22. ////////////////////////////////////////////////////////////////////
  23. // Function: GlobPattern::Copy Constructor
  24. // Access: Public
  25. // Description:
  26. ////////////////////////////////////////////////////////////////////
  27. INLINE GlobPattern::
  28. GlobPattern(const GlobPattern &copy) : _pattern(copy._pattern) {
  29. }
  30. ////////////////////////////////////////////////////////////////////
  31. // Function: GlobPattern::Copy Assignment Operator
  32. // Access: Public
  33. // Description:
  34. ////////////////////////////////////////////////////////////////////
  35. INLINE void GlobPattern::
  36. operator = (const GlobPattern &copy) {
  37. _pattern = copy._pattern;
  38. }
  39. ////////////////////////////////////////////////////////////////////
  40. // Function: GlobPattern::set_pattern
  41. // Access: Public
  42. // Description: Changes the pattern string that the GlobPattern
  43. // object matches.
  44. ////////////////////////////////////////////////////////////////////
  45. INLINE void GlobPattern::
  46. set_pattern(const string &pattern) {
  47. _pattern = pattern;
  48. }
  49. ////////////////////////////////////////////////////////////////////
  50. // Function: GlobPattern::get_pattern
  51. // Access: Public
  52. // Description: Returns the pattern string that the GlobPattern
  53. // object matches.
  54. ////////////////////////////////////////////////////////////////////
  55. INLINE const string &GlobPattern::
  56. get_pattern() const {
  57. return _pattern;
  58. }
  59. ////////////////////////////////////////////////////////////////////
  60. // Function: GlobPattern::matches
  61. // Access: Public
  62. // Description: Returns true if the candidate string matches the
  63. // pattern, false otherwise.
  64. ////////////////////////////////////////////////////////////////////
  65. INLINE bool GlobPattern::
  66. matches(const string &candidate) const {
  67. return matches_substr(_pattern.begin(), _pattern.end(),
  68. candidate.begin(), candidate.end());
  69. }
  70. ////////////////////////////////////////////////////////////////////
  71. // Function: GlobPattern::output
  72. // Access: Public
  73. // Description:
  74. ////////////////////////////////////////////////////////////////////
  75. INLINE void GlobPattern::
  76. output(ostream &out) const {
  77. out << _pattern;
  78. }