3#include <hpp/filesystem.hpp>
6#include <unordered_map>
13using protocols_t = std::unordered_map<std::string, std::string>;
16template<
typename Container = std::
string,
typename CharT =
char,
typename Traits = std::
char_traits<
char>>
20 std::is_same<Container, std::basic_string<CharT, Traits, typename Container::allocator_type>>::value ||
21 std::is_same<Container, std::vector<CharT, typename Container::allocator_type>>::value ||
22 std::is_same<Container,
23 std::vector<std::make_unsigned_t<CharT>,
typename Container::allocator_type>>::value ||
24 std::is_same<Container, std::vector<std::make_signed_t<CharT>,
typename Container::allocator_type>>::value,
25 "only strings and vectors of ((un)signed) CharT allowed");
30 membuf(
const typename Container::value_type* begin,
size_t size)
32 auto cbegin =
reinterpret_cast<char*
>(
const_cast<typename Container::value_type*
>(begin));
33 this->setg(cbegin, cbegin, cbegin +
size);
54auto add_path_protocol(
const std::string& protocol,
const path& directory) -> bool;
123auto replace(
const path& _path,
const path& _sequence,
const path& _new_sequence) -> path;
131auto split_until(
const path& _path,
const path& _predicate) -> std::vector<path>;
membuf(const typename Container::value_type *begin, size_t size)
bool 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 ...
path extract_protocol(const path &_path)
Given the specified path/filename, resolve the final full filename. This will be based on either the ...
stream_buffer< std::string > read_stream_buffer_str(std::istream &stream)
std::unordered_map< std::string, std::string > protocols_t
path reduce_trailing_extensions(const path &_path)
another.
byte_array_t 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...
path resolve_protocol(const path &_path)
Given the specified path/filename, resolve the final full filename. This will be based on either the ...
bool has_known_protocol(const path &_path)
Checks whether the path has a known protocol.
path replace(const path &_path, const path &_sequence, const path &_new_sequence)
Replacing any occurences of the specified path sequence with another.
std::string read_stream_str(std::istream &stream)
bool is_any_parent_path(const path &parent, const path &child)
std::vector< std::uint8_t > byte_array_t
protocols_t & get_path_protocols()
Returns the registered path protocols.
std::vector< path > split_until(const path &_path, const path &_predicate)
another.
stream_buffer< byte_array_t > read_stream_buffer(std::istream &stream)
path convert_to_protocol(const path &_path)
Oposite of the resolve_protocol this function tries to convert to protocol path from an absolute one.
auto get_stream_buf() const -> membuf