Unravel Engine C++ Reference
Loading...
Searching...
No Matches
fs Namespace Reference

Namespaces

namespace  detail
 

Classes

class  cache
 
class  pattern_filter
 A filter that combines include and exclude patterns for file/directory filtering. More...
 
struct  stream_buffer
 
class  syncer
 
class  watcher
 
class  wildcard_pattern
 A wildcard pattern matcher that supports * (match any sequence) and ? (match single character) More...
 

Typedefs

using directory_cache = cache<directory_iterator>
 
using recursive_directory_cache = cache<recursive_directory_iterator>
 
using protocols_t = std::unordered_map<std::string, std::string>
 
using byte_array_t = std::vector<std::uint8_t>
 

Functions

template<typename Iterator = recursive_directory_iterator>
auto make_filtered_cache (const fs::path &path, const std::vector< std::string > &includes, const std::vector< std::string > &excludes={}, std::chrono::steady_clock::duration scan_frequency=std::chrono::milliseconds(500)) -> cache< Iterator >
 Convenience function to create a directory cache with pattern filtering.
 
bool is_case_insensitive ()
 
byte_array_t read_stream (std::istream &stream) -> byte_array_t
 Load a byte_array_t with the contents of the specified file, be that file in a package or in the main file system.
 
std::string read_stream_str (std::istream &stream)
 
stream_buffer< byte_array_tread_stream_buffer (std::istream &stream)
 
stream_buffer< std::string > read_stream_buffer_str (std::istream &stream)
 
bool add_path_protocol (const std::string &protocol, const path &directory) -> bool
 Allows us to map a protocol to a specific directory. A path protocol gives the caller the ability to prepend an identifier to their file name i.e. "engine_data://textures/tex.png" and have it return the relevant mapped path.
 
protocols_tget_path_protocols () -> protocols_t &
 Returns the registered path protocols.
 
path extract_protocol (const path &_path) -> path
 Given the specified path/filename, resolve the final full filename. This will be based on either the currently specified root path, or one of the 'path protocol' identifiers if it is included in the filename.
 
path resolve_protocol (const path &_path) -> path
 Given the specified path/filename, resolve the final full filename. This will be based on either the currently specified root path, or one of the 'path protocol' identifiers if it is included in the filename.
 
bool has_known_protocol (const path &_path) -> bool
 Checks whether the path has a known protocol.
 
path convert_to_protocol (const path &_path) -> path
 Oposite of the resolve_protocol this function tries to convert to protocol path from an absolute one.
 
path replace (const path &_path, const path &_sequence, const path &_new_sequence) -> path
 Replacing any occurences of the specified path sequence with another.
 
std::vector< path > split_until (const path &_path, const path &_predicate) -> std::vector< path >
 another.
 
path reduce_trailing_extensions (const path &_path) -> path
 another.
 
bool is_any_parent_path (const path &parent, const path &child)
 
auto make_pattern_filter (const std::string &pattern) -> pattern_filter
 Convenience function to create a pattern filter from a single wildcard string Maintains backward compatibility with existing "*" usage.
 
auto make_pattern_filter (const std::vector< std::string > &includes, const std::vector< std::string > &excludes={}) -> pattern_filter
 Convenience function to create a pattern filter with include and exclude lists.
 
auto to_string (const watcher::entry &e) -> std::string
 

Typedef Documentation

◆ byte_array_t

using fs::byte_array_t = std::vector<std::uint8_t>

Definition at line 14 of file filesystem.h.

◆ directory_cache

using fs::directory_cache = cache<directory_iterator>

Definition at line 280 of file cache.hpp.

◆ protocols_t

using fs::protocols_t = std::unordered_map<std::string, std::string>

Definition at line 13 of file filesystem.h.

◆ recursive_directory_cache

using fs::recursive_directory_cache = cache<recursive_directory_iterator>

Definition at line 281 of file cache.hpp.

Function Documentation

◆ add_path_protocol()

auto fs::add_path_protocol ( const std::string & protocol,
const path & dir )

Allows us to map a protocol to a specific directory. A path protocol gives the caller the ability to prepend an identifier to their file name i.e. "engine_data://textures/tex.png" and have it return the relevant mapped path.

Definition at line 181 of file filesystem.cpp.

◆ convert_to_protocol()

auto fs::convert_to_protocol ( const path & _path)

Oposite of the resolve_protocol this function tries to convert to protocol path from an absolute one.

Definition at line 265 of file filesystem.cpp.

◆ extract_protocol()

auto fs::extract_protocol ( const path & _path)

Given the specified path/filename, resolve the final full filename. This will be based on either the currently specified root path, or one of the 'path protocol' identifiers if it is included in the filename.

Definition at line 200 of file filesystem.cpp.

◆ get_path_protocols()

auto fs::get_path_protocols ( )

Returns the registered path protocols.

Definition at line 194 of file filesystem.cpp.

◆ has_known_protocol()

auto fs::has_known_protocol ( const path & _path)

Checks whether the path has a known protocol.

Definition at line 246 of file filesystem.cpp.

◆ is_any_parent_path()

auto fs::is_any_parent_path ( const path & parent,
const path & child )

Definition at line 342 of file filesystem.cpp.

◆ is_case_insensitive()

bool fs::is_case_insensitive ( )

Definition at line 125 of file filesystem.cpp.

◆ make_filtered_cache()

template<typename Iterator = recursive_directory_iterator>
auto fs::make_filtered_cache ( const fs::path & path,
const std::vector< std::string > & includes,
const std::vector< std::string > & excludes = {},
std::chrono::steady_clock::duration scan_frequency = std::chrono::milliseconds(500) ) -> cache<Iterator>

Convenience function to create a directory cache with pattern filtering.

Parameters
pathDirectory path to cache
includesInclude patterns
excludesExclude patterns
scan_frequencyHow often to scan for changes
Returns
Directory cache with pattern filtering

Definition at line 292 of file cache.hpp.

◆ make_pattern_filter() [1/2]

auto fs::make_pattern_filter ( const std::string & pattern) -> pattern_filter

Convenience function to create a pattern filter from a single wildcard string Maintains backward compatibility with existing "*" usage.

Parameters
patternSingle pattern string
Returns
Pattern filter configured with the single include pattern

Definition at line 175 of file pattern_filter.cpp.

◆ make_pattern_filter() [2/2]

auto fs::make_pattern_filter ( const std::vector< std::string > & includes,
const std::vector< std::string > & excludes = {} ) -> pattern_filter

Convenience function to create a pattern filter with include and exclude lists.

Parameters
includesInclude patterns (OR logic)
excludesExclude patterns (NOT logic)
Returns
Pattern filter configured with the specified patterns

Definition at line 180 of file pattern_filter.cpp.

◆ read_stream()

auto fs::read_stream ( std::istream & stream)

Load a byte_array_t with the contents of the specified file, be that file in a package or in the main file system.

Definition at line 153 of file filesystem.cpp.

◆ read_stream_buffer()

auto fs::read_stream_buffer ( std::istream & stream)

Definition at line 167 of file filesystem.cpp.

◆ read_stream_buffer_str()

auto fs::read_stream_buffer_str ( std::istream & stream)

Definition at line 174 of file filesystem.cpp.

◆ read_stream_str()

auto fs::read_stream_str ( std::istream & stream)

Definition at line 160 of file filesystem.cpp.

◆ reduce_trailing_extensions()

auto fs::reduce_trailing_extensions ( const path & _path)

another.

Definition at line 328 of file filesystem.cpp.

◆ replace()

auto fs::replace ( const path & _path,
const path & _sequence,
const path & _new_sequence )

Replacing any occurences of the specified path sequence with another.

Definition at line 305 of file filesystem.cpp.

◆ resolve_protocol()

auto fs::resolve_protocol ( const path & _path)

Given the specified path/filename, resolve the final full filename. This will be based on either the currently specified root path, or one of the 'path protocol' identifiers if it is included in the filename.

Definition at line 215 of file filesystem.cpp.

◆ split_until()

auto fs::split_until ( const path & _path,
const path & _predicate )

another.

Definition at line 310 of file filesystem.cpp.

◆ to_string()

auto fs::to_string ( const watcher::entry & e) -> std::string

Definition at line 617 of file watcher.cpp.