Panda3D
dSearchPath.I
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file dSearchPath.I
10  * @author drose
11  * @date 2000-07-01
12  */
13 
14 /**
15  * Returns the nth filename in the set. This method is defined to make the
16  * Results object appear to be a list in Python.
17  */
19 operator [] (size_t n) const {
20  return get_file(n);
21 }
22 
23 /**
24  * Returns the num of filenames in the set. This method is defined to make
25  * the Results object appear to be a list in Python.
26  */
27 INLINE size_t DSearchPath::Results::
28 size() const {
29  return get_num_files();
30 }
31 
32 /**
33  * This variant of find_all_files() returns the new Results object, instead of
34  * filling on in on the parameter list. This is a little more convenient to
35  * call from Python.
36  */
38 find_all_files(const Filename &filename) const {
39  Results results;
40  find_all_files(filename, results);
41  return results;
42 }
43 
44 /**
45  * A quick-and-easy way to search a searchpath for a file when you don't feel
46  * like building or keeping around a DSearchPath object. This simply
47  * constructs a temporary DSearchPath based on the indicated path string, and
48  * searches that.
49  */
51 search_path(const Filename &filename, const std::string &path,
52  const std::string &separator) {
53  DSearchPath search(path, separator);
54  return search.find_file(filename);
55 }
size_t size() const
Returns the num of filenames in the set.
Definition: dSearchPath.I:28
const Filename & get_file(size_t n) const
Returns the nth file on the result list.
Definition: dSearchPath.cxx:74
size_t find_all_files(const Filename &filename, Results &results) const
Searches all the directories in the search list for the indicated file, in order.
Filename operator [](size_t n) const
Returns the nth filename in the set.
Definition: dSearchPath.I:19
The name of a file, such as a texture file or an Egg file.
Definition: filename.h:39
This class stores a list of directories that can be searched, in order, to locate a particular file.
Definition: dSearchPath.h:28
static Filename search_path(const Filename &filename, const std::string &path, const std::string &separator=std::string())
A quick-and-easy way to search a searchpath for a file when you don't feel like building or keeping a...
Definition: dSearchPath.I:51
Filename find_file(const Filename &filename) const
Searches all the directories in the search list for the indicated file, in order.