14#ifndef PANDASEARCHPATH_H
15#define PANDASEARCHPATH_H
28class EXPCL_DTOOL_DTOOLUTIL DSearchPath {
30 class EXPCL_DTOOL_DTOOLUTIL Results {
33 Results(
const Results ©);
34 void operator = (
const Results ©);
41 INLINE
Filename operator [] (
size_t n)
const;
42 INLINE
size_t size()
const;
44 void output(std::ostream &out)
const;
45 void write(std::ostream &out,
int indent_level = 0)
const;
51 typedef pvector<Filename> Files;
55 DSearchPath() =
default;
56 DSearchPath(
const std::string &path,
const std::string &separator = std::string());
57 DSearchPath(
const Filename &directory);
58 DSearchPath(
const DSearchPath ©) =
default;
59 DSearchPath(DSearchPath &&from) =
default;
60 ~DSearchPath() =
default;
62 DSearchPath &operator = (
const DSearchPath ©) =
default;
63 DSearchPath &operator = (DSearchPath &&from) =
default;
69 const std::string &separator = std::string());
85 const std::string &separator = std::string());
87 void output(std::ostream &out,
const std::string &separator = std::string())
const;
88 void write(std::ostream &out,
int indent_level = 0)
const;
91 typedef pvector<Filename> Directories;
92 Directories _directories;
95INLINE std::ostream &operator << (std::ostream &out,
const DSearchPath &sp) {
void clear()
Removes all the files from the list.
const Filename & get_file(size_t n) const
Returns the nth file on the result list.
size_t size() const
Returns the num of filenames in the set.
void add_file(const Filename &file)
Adds a new file to the result list.
size_t get_num_files() const
Returns the number of files on the result list.
This class stores a list of directories that can be searched, in order, to locate a particular file.
Filename find_file(const Filename &filename) const
Searches all the directories in the search list for the indicated file, in order.
bool is_empty() const
Returns true if the search list is empty, false otherwise.
void append_path(const std::string &path, const std::string &separator=std::string())
Adds all of the directories listed in the search path to the end of the search list.
get_num_directories
Returns the number of directories on the search list.
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.
void prepend_path(const DSearchPath &path)
Adds all of the directories listed in the search path to the beginning of the search list.
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...
void prepend_directory(const Filename &directory)
Adds a new directory to the front of the search list.
void clear()
Removes all the directories from the search list.
void append_directory(const Filename &directory)
Adds a new directory to the end of the search list.
get_directory
Returns the nth directory on the search list.
The name of a file, such as a texture file or an Egg file.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.