GlobPattern
from panda3d.core import GlobPattern
- class GlobPattern
Bases:
DTOOL_SUPER_BASE
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.
Inheritance diagram
- __init__(*args, **kwargs)
- assign()
C++ Interface: assign(const GlobPattern self, const GlobPattern copy)
- case_sensitive
- getCaseSensitive()
C++ Interface: get_case_sensitive(GlobPattern self)
- /**
Returns whether the match is case sensitive (true) or case insensitive
(false). The default is case sensitive.
*/
- getConstPrefix()
C++ Interface: get_const_prefix(GlobPattern self)
- /**
Returns the initial part of the pattern before the first glob character.
Since many glob patterns begin with a sequence of static characters and end
with one or more glob characters, this can be used to optimized searches
through sorted indices.
*/
- getNomatchChars()
C++ Interface: get_nomatch_chars(GlobPattern self)
- /**
Returns the set of characters that are not matched by * or ?.
*/
- getPattern()
C++ Interface: get_pattern(GlobPattern self)
- /**
Returns the pattern string that the GlobPattern object matches.
*/
- get_case_sensitive()
C++ Interface: get_case_sensitive(GlobPattern self)
- /**
Returns whether the match is case sensitive (true) or case insensitive
(false). The default is case sensitive.
*/
- get_const_prefix()
C++ Interface: get_const_prefix(GlobPattern self)
- /**
Returns the initial part of the pattern before the first glob character.
Since many glob patterns begin with a sequence of static characters and end
with one or more glob characters, this can be used to optimized searches
through sorted indices.
*/
- get_nomatch_chars()
C++ Interface: get_nomatch_chars(GlobPattern self)
- /**
Returns the set of characters that are not matched by * or ?.
*/
- get_pattern()
C++ Interface: get_pattern(GlobPattern self)
- /**
Returns the pattern string that the GlobPattern object matches.
*/
- hasGlobCharacters()
C++ Interface: has_glob_characters(GlobPattern self)
- /**
Returns true if the pattern includes any special globbing characters, or
false if it is just a literal string.
*/
- has_glob_characters()
C++ Interface: has_glob_characters(GlobPattern self)
- /**
Returns true if the pattern includes any special globbing characters, or
false if it is just a literal string.
*/
- matchFiles()
C++ Interface: match_files(GlobPattern self, const Filename cwd)
- /**
Treats the GlobPattern as a filename pattern, and returns a list of any
actual files that match the pattern. This is the behavior of the standard
Posix glob() function. Any part of the filename may contain glob
characters, including intermediate directory names.
If cwd is specified, it is the directory that relative filenames are taken
to be relative to; otherwise, the actual current working directory is
assumed.
The return value is the number of files matched, which are added to the
results vector.
*/
- match_files()
C++ Interface: match_files(GlobPattern self, const Filename cwd)
- /**
Treats the GlobPattern as a filename pattern, and returns a list of any
actual files that match the pattern. This is the behavior of the standard
Posix glob() function. Any part of the filename may contain glob
characters, including intermediate directory names.
If cwd is specified, it is the directory that relative filenames are taken
to be relative to; otherwise, the actual current working directory is
assumed.
The return value is the number of files matched, which are added to the
results vector.
*/
- matches()
C++ Interface: matches(GlobPattern self, str candidate)
- /**
Returns true if the candidate string matches the pattern, false otherwise.
*/
- matchesFile()
C++ Interface: matches_file(GlobPattern self, Filename candidate)
- /**
Treats the GlobPattern as a filename pattern, and returns true if the given
filename matches the pattern. Unlike matches(), this will not match slash
characters for single asterisk characters, and it will ignore path
components that only contain a dot.
*/
- matches_file()
C++ Interface: matches_file(GlobPattern self, Filename candidate)
- /**
Treats the GlobPattern as a filename pattern, and returns true if the given
filename matches the pattern. Unlike matches(), this will not match slash
characters for single asterisk characters, and it will ignore path
components that only contain a dot.
*/
- nomatch_chars
- pattern
- setCaseSensitive()
C++ Interface: set_case_sensitive(const GlobPattern self, bool case_sensitive)
- /**
Sets whether the match is case sensitive (true) or case insensitive
(false). The default is case sensitive.
*/
- setNomatchChars()
C++ Interface: set_nomatch_chars(const GlobPattern self, str nomatch_chars)
- /**
Specifies a set of characters that are not matched by * or ?.
*/
- setPattern()
C++ Interface: set_pattern(const GlobPattern self, str pattern)
- /**
Changes the pattern string that the GlobPattern object matches.
*/
- set_case_sensitive()
C++ Interface: set_case_sensitive(const GlobPattern self, bool case_sensitive)
- /**
Sets whether the match is case sensitive (true) or case insensitive
(false). The default is case sensitive.
*/