Panda3D
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
DSearchPath Class Reference

This class stores a list of directories that can be searched, in order, to locate a particular file. More...

Classes

class  Results
 

Public Member Functions

 __init__ ()
 
 __init__ (DSearchPath from)
 
 __init__ (const DSearchPath copy)
 
 __init__ (const Filename directory)
 
 __init__ (str path, str separator)
 
 appendDirectory (const Filename directory)
 Adds a new directory to the end of the search list. More...
 
 appendPath (const DSearchPath path)
 Adds all of the directories listed in the search path to the end of the search list. More...
 
 appendPath (str path, str separator)
 Adds all of the directories listed in the search path to the end of the search list. More...
 
 clear ()
 Removes all the directories from the search list. More...
 
DSearchPath::Results findAllFiles (const Filename filename)
 This variant of find_all_files() returns the new Results object, instead of filling on in on the parameter list. More...
 
int findAllFiles (const Filename filename, DSearchPath::Results results)
 Searches all the directories in the search list for the indicated file, in order. More...
 
Filename findFile (const Filename filename)
 Searches all the directories in the search list for the indicated file, in order. More...
 
list getDirectories ()
 
const Filename getDirectory (int n)
 Returns the nth directory on the search list. More...
 
int getNumDirectories ()
 Returns the number of directories on the search list. More...
 
bool isEmpty ()
 Returns true if the search list is empty, false otherwise. More...
 
DSearchPath operator= (DSearchPath from)
 
DSearchPath operator= (const DSearchPath copy)
 
 output (Ostream out, str separator)
 
 prependDirectory (const Filename directory)
 Adds a new directory to the front of the search list. More...
 
 prependPath (const DSearchPath path)
 Adds all of the directories listed in the search path to the beginning of the search list. More...
 
 write (Ostream out, int indent_level)
 

Static Public Member Functions

static Filename searchPath (const Filename filename, str path, str separator)
 A quick-and-easy way to search a searchpath for a file when you don't feel like building or keeping around a DSearchPath object. More...
 

Public Attributes

const Filename directories []
 

Detailed Description

This class stores a list of directories that can be searched, in order, to locate a particular file.

It is normally constructed by passing it a traditional searchpath-style string, e.g. a list of directory names delimited by spaces or colons, but it can also be built up explicitly.

Member Function Documentation

◆ __init__() [1/5]

__init__ ( )

◆ __init__() [2/5]

__init__ ( DSearchPath  from)

◆ __init__() [3/5]

__init__ ( const DSearchPath  copy)

◆ __init__() [4/5]

__init__ ( const Filename  directory)

◆ __init__() [5/5]

__init__ ( str  path,
str  separator 
)

◆ appendDirectory()

appendDirectory ( const Filename  directory)

Adds a new directory to the end of the search list.

◆ appendPath() [1/2]

appendPath ( const DSearchPath  path)

Adds all of the directories listed in the search path to the end of the search list.

◆ appendPath() [2/2]

appendPath ( str  path,
str  separator 
)

Adds all of the directories listed in the search path to the end of the search list.

◆ clear()

clear ( )

Removes all the directories from the search list.

◆ findAllFiles() [1/2]

DSearchPath::Results findAllFiles ( const Filename  filename)

This variant of find_all_files() returns the new Results object, instead of filling on in on the parameter list.

This is a little more convenient to call from Python.

◆ findAllFiles() [2/2]

int findAllFiles ( const Filename  filename,
DSearchPath::Results  results 
)

Searches all the directories in the search list for the indicated file, in order.

Fills up the results list with all of the matching filenames found, if any. Returns the number of matches found.

It is the responsibility of the the caller to clear the results list first; otherwise, the newly-found files will be appended to the list.

◆ findFile()

Filename findFile ( const Filename  filename)

Searches all the directories in the search list for the indicated file, in order.

Returns the full matching pathname of the first match if found, or the empty string if not found.

◆ getDirectories()

list getDirectories ( )

◆ getDirectory()

const Filename getDirectory ( int  n)

Returns the nth directory on the search list.

◆ getNumDirectories()

int getNumDirectories ( )

Returns the number of directories on the search list.

◆ isEmpty()

bool isEmpty ( )

Returns true if the search list is empty, false otherwise.

◆ operator=() [1/2]

DSearchPath operator= ( DSearchPath  from)

◆ operator=() [2/2]

DSearchPath operator= ( const DSearchPath  copy)

◆ output()

output ( Ostream  out,
str  separator 
)

◆ prependDirectory()

prependDirectory ( const Filename  directory)

Adds a new directory to the front of the search list.

◆ prependPath()

prependPath ( const DSearchPath  path)

Adds all of the directories listed in the search path to the beginning of the search list.

◆ searchPath()

static Filename searchPath ( const Filename  filename,
str  path,
str  separator 
)
static

A quick-and-easy way to search a searchpath for a file when you don't feel like building or keeping around a DSearchPath object.

This simply constructs a temporary DSearchPath based on the indicated path string, and searches that.

◆ write()

write ( Ostream  out,
int  indent_level 
)

Member Data Documentation

◆ directories

const Filename directories[]