Panda3D
Public Member Functions | List of all members
GlobPattern Class Reference

This class can be used to test for string matches against standard Unix-shell filename globbing conventions. It serves as a portable standin for the Posix fnmatch() call. More...

Public Member Functions

 __init__ (const GlobPattern copy)
 
 __init__ (str pattern)
 
bool getCaseSensitive ()
 Returns whether the match is case sensitive (true) or case insensitive (false). The default is case sensitive. More...
 
str getConstPrefix ()
 
str getNomatchChars ()
 Returns the set of characters that are not matched by. More...
 
str getPattern ()
 Returns the pattern string that the GlobPattern object matches. More...
 
bool hasGlobCharacters ()
 
bool matches (str candidate)
 Returns true if the candidate string matches the pattern, false otherwise. More...
 
object matchFiles (const Filename cwd)
 
int matchFiles (VectorString results, const Filename cwd)
 
bool operator!= (const GlobPattern other)
 
bool operator< (const GlobPattern other)
 
GlobPattern operator= (const GlobPattern copy)
 
bool operator== (const GlobPattern other)
 
 output (Ostream out)
 
 setCaseSensitive (bool case_sensitive)
 Sets whether the match is case sensitive (true) or case insensitive (false). The default is case sensitive. More...
 
 setNomatchChars (str nomatch_chars)
 Specifies a set of characters that are not matched by. More...
 
 setPattern (str pattern)
 Changes the pattern string that the GlobPattern object matches. More...
 

Detailed Description

This class can be used to test for string matches against standard Unix-shell filename globbing conventions. It serves as a portable standin for the Posix fnmatch() call.

A GlobPattern is given a pattern string, which can contain operators like *, ?, and []. Then it can be tested against any number of candidate strings; for each candidate, it will indicate whether the string matches the pattern or not. It can be used, for example, to scan a directory for all files matching a particular pattern.

Member Function Documentation

◆ __init__() [1/2]

__init__ ( const GlobPattern  copy)

◆ __init__() [2/2]

__init__ ( str  pattern)

◆ getCaseSensitive()

bool getCaseSensitive ( )

Returns whether the match is case sensitive (true) or case insensitive (false). The default is case sensitive.

◆ getConstPrefix()

str getConstPrefix ( )

◆ getNomatchChars()

str getNomatchChars ( )

Returns the set of characters that are not matched by.

  • or ?.

◆ getPattern()

str getPattern ( )

Returns the pattern string that the GlobPattern object matches.

◆ hasGlobCharacters()

bool hasGlobCharacters ( )

◆ matches()

bool matches ( str  candidate)

Returns true if the candidate string matches the pattern, false otherwise.

◆ matchFiles() [1/2]

object matchFiles ( const Filename  cwd)

◆ matchFiles() [2/2]

int matchFiles ( VectorString  results,
const Filename  cwd 
)

◆ operator!=()

bool operator!= ( const GlobPattern  other)

◆ operator<()

bool operator< ( const GlobPattern  other)

◆ operator=()

GlobPattern operator= ( const GlobPattern  copy)

◆ operator==()

bool operator== ( const GlobPattern  other)

◆ output()

output ( Ostream  out)

◆ setCaseSensitive()

setCaseSensitive ( bool  case_sensitive)

Sets whether the match is case sensitive (true) or case insensitive (false). The default is case sensitive.

◆ setNomatchChars()

setNomatchChars ( str  nomatch_chars)

Specifies a set of characters that are not matched by.

  • or ?.

◆ setPattern()

setPattern ( str  pattern)

Changes the pattern string that the GlobPattern object matches.