#include <file_search_path.hpp>
|
| | FileSearchPath ()=default |
| | Construct an empty search path.
|
| | FileSearchPath (std::string_view serialized) |
| | Construct from a PATH-style serialized string.
|
| std::size_t | size () const noexcept |
| | Number of directories in the search path.
|
| bool | empty () const noexcept |
| | True when the search path contains no directories.
|
| const std::filesystem::path & | operator[] (std::size_t i) const |
| | Access the path at index i (no bounds check beyond size()).
|
| void | add (const std::filesystem::path &dir) |
| | Append dir to the end of the search list.
|
| void | add_at_front (const std::filesystem::path &dir) |
| | Insert dir at the front so it is searched before everything else.
|
| void | clear () noexcept |
| | Remove all directories.
|
| void | remove (std::size_t i) |
| | Remove the directory at index i. Out-of-range index is a no-op.
|
| const std::vector< std::filesystem::path > & | paths () const noexcept |
| | Read-only view of the directories in search order.
|
| std::optional< std::filesystem::path > | find (const std::filesystem::path &filename) const |
| | Search the path for filename and return the first match, or nullopt if no directory contains it.
|
| std::vector< std::filesystem::path > | find_all (const std::filesystem::path &filename) const |
| | Search the path for filename and return ALL matches across every directory, in search order.
|
| std::string | to_string () const |
| | Serialize the search path to a PATH-style string using separator().
|
| void | from_string (std::string_view serialized) |
| | Replace the contents of the search path with the entries parsed from serialized.
|
| bool | operator== (const FileSearchPath &other) const noexcept |
| bool | operator!= (const FileSearchPath &other) const noexcept |
|
| static constexpr char | separator () noexcept |
| | The platform-native PATH separator: : on POSIX, ; on Windows.
|
◆ FileSearchPath() [1/2]
| pulp::runtime::FileSearchPath::FileSearchPath |
( |
| ) |
|
|
default |
Construct an empty search path.
◆ FileSearchPath() [2/2]
| pulp::runtime::FileSearchPath::FileSearchPath |
( |
std::string_view | serialized | ) |
|
|
inlineexplicit |
Construct from a PATH-style serialized string.
Same semantics as from_string() — empty/duplicate entries are dropped.
◆ add()
| void pulp::runtime::FileSearchPath::add |
( |
const std::filesystem::path & | dir | ) |
|
|
inline |
Append dir to the end of the search list.
No-op if dir is already present (preserves the existing position).
◆ add_at_front()
| void pulp::runtime::FileSearchPath::add_at_front |
( |
const std::filesystem::path & | dir | ) |
|
|
inline |
Insert dir at the front so it is searched before everything else.
If dir is already present elsewhere in the list it is moved to the front (no duplicates).
◆ clear()
| void pulp::runtime::FileSearchPath::clear |
( |
| ) |
|
|
inlinenoexcept |
◆ empty()
| bool pulp::runtime::FileSearchPath::empty |
( |
| ) |
const |
|
inlinenoexcept |
True when the search path contains no directories.
◆ find()
| std::optional< std::filesystem::path > pulp::runtime::FileSearchPath::find |
( |
const std::filesystem::path & | filename | ) |
const |
|
inline |
Search the path for filename and return the first match, or nullopt if no directory contains it.
filename is appended as a relative path to each directory in order; the first hit that std::filesystem::exists() accepts wins.
◆ find_all()
| std::vector< std::filesystem::path > pulp::runtime::FileSearchPath::find_all |
( |
const std::filesystem::path & | filename | ) |
const |
|
inline |
Search the path for filename and return ALL matches across every directory, in search order.
Useful for overlays where later directories shadow earlier ones and the caller wants to see both.
◆ from_string()
| void pulp::runtime::FileSearchPath::from_string |
( |
std::string_view | serialized | ) |
|
|
inline |
Replace the contents of the search path with the entries parsed from serialized.
Splits on the platform PATH separator; empty segments and duplicates are dropped. Existing entries are cleared first.
◆ operator!=()
| bool pulp::runtime::FileSearchPath::operator!= |
( |
const FileSearchPath & | other | ) |
const |
|
inlinenoexcept |
◆ operator==()
| bool pulp::runtime::FileSearchPath::operator== |
( |
const FileSearchPath & | other | ) |
const |
|
inlinenoexcept |
◆ operator[]()
| const std::filesystem::path & pulp::runtime::FileSearchPath::operator[] |
( |
std::size_t | i | ) |
const |
|
inline |
Access the path at index i (no bounds check beyond size()).
◆ paths()
| const std::vector< std::filesystem::path > & pulp::runtime::FileSearchPath::paths |
( |
| ) |
const |
|
inlinenoexcept |
Read-only view of the directories in search order.
◆ remove()
| void pulp::runtime::FileSearchPath::remove |
( |
std::size_t | i | ) |
|
|
inline |
Remove the directory at index i. Out-of-range index is a no-op.
◆ separator()
| constexpr char pulp::runtime::FileSearchPath::separator |
( |
| ) |
|
|
inlinestaticconstexprnoexcept |
The platform-native PATH separator: : on POSIX, ; on Windows.
◆ size()
| std::size_t pulp::runtime::FileSearchPath::size |
( |
| ) |
const |
|
inlinenoexcept |
Number of directories in the search path.
◆ to_string()
| std::string pulp::runtime::FileSearchPath::to_string |
( |
| ) |
const |
|
inline |
The documentation for this class was generated from the following file: