globPattern.I 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. // Filename: globPattern.I
  2. // Created by: drose (30May00)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
  8. //
  9. // All use of this software is subject to the terms of the Panda 3d
  10. // Software license. You should have received a copy of this license
  11. // along with this source code; you will also find a current copy of
  12. // the license at http://www.panda3d.org/license.txt .
  13. //
  14. // To contact the maintainers of this program write to
  15. // [email protected] .
  16. //
  17. ////////////////////////////////////////////////////////////////////
  18. ////////////////////////////////////////////////////////////////////
  19. // Function: GlobPattern::Constructor
  20. // Access: Public
  21. // Description:
  22. ////////////////////////////////////////////////////////////////////
  23. INLINE GlobPattern::
  24. GlobPattern(const string &pattern) : _pattern(pattern) {
  25. }
  26. ////////////////////////////////////////////////////////////////////
  27. // Function: GlobPattern::Copy Constructor
  28. // Access: Public
  29. // Description:
  30. ////////////////////////////////////////////////////////////////////
  31. INLINE GlobPattern::
  32. GlobPattern(const GlobPattern &copy) : _pattern(copy._pattern) {
  33. }
  34. ////////////////////////////////////////////////////////////////////
  35. // Function: GlobPattern::Copy Assignment Operator
  36. // Access: Public
  37. // Description:
  38. ////////////////////////////////////////////////////////////////////
  39. INLINE void GlobPattern::
  40. operator = (const GlobPattern &copy) {
  41. _pattern = copy._pattern;
  42. }
  43. ////////////////////////////////////////////////////////////////////
  44. // Function: GlobPattern::set_pattern
  45. // Access: Public
  46. // Description: Changes the pattern string that the GlobPattern
  47. // object matches.
  48. ////////////////////////////////////////////////////////////////////
  49. INLINE void GlobPattern::
  50. set_pattern(const string &pattern) {
  51. _pattern = pattern;
  52. }
  53. ////////////////////////////////////////////////////////////////////
  54. // Function: GlobPattern::get_pattern
  55. // Access: Public
  56. // Description: Returns the pattern string that the GlobPattern
  57. // object matches.
  58. ////////////////////////////////////////////////////////////////////
  59. INLINE const string &GlobPattern::
  60. get_pattern() const {
  61. return _pattern;
  62. }
  63. ////////////////////////////////////////////////////////////////////
  64. // Function: GlobPattern::matches
  65. // Access: Public
  66. // Description: Returns true if the candidate string matches the
  67. // pattern, false otherwise.
  68. ////////////////////////////////////////////////////////////////////
  69. INLINE bool GlobPattern::
  70. matches(const string &candidate) const {
  71. return matches_substr(_pattern.begin(), _pattern.end(),
  72. candidate.begin(), candidate.end());
  73. }
  74. ////////////////////////////////////////////////////////////////////
  75. // Function: GlobPattern::output
  76. // Access: Public
  77. // Description:
  78. ////////////////////////////////////////////////////////////////////
  79. INLINE void GlobPattern::
  80. output(ostream &out) const {
  81. out << _pattern;
  82. }