📂 golxzn::os::filesystem 📂 1.6.5
golxzn filesystem submodule
Loading...
Searching...
No Matches
Reading files

Functions

static std::vector< byte > golxzn::os::filesystem::read_binary (const std::wstring_view path)
 Read whole binary file.
 
static std::string golxzn::os::filesystem::read_text (const std::wstring_view path)
 Read whole text file.
 
template<class Custom >
static auto golxzn::os::filesystem::read_binary (const std::wstring_view path) -> std::enable_if_t< std::is_constructible_v< Custom, std::vector< byte > >, Custom >
 Construct Custom class by binary data from file.
 
template<class Custom >
static auto golxzn::os::filesystem::read_text (const std::wstring_view path) -> std::enable_if_t< std::is_constructible_v< Custom, std::string >, Custom >
 Construct Custom class by text data from file.
 
template<class Custom >
static auto golxzn::os::filesystem::read_shared_binary (const std::wstring_view path) -> std::enable_if_t< std::is_constructible_v< Custom, std::vector< byte > >, std::shared_ptr< Custom > >
 Construct std::shared_ptr<Custom> by binary data from file.
 
template<class Custom >
static auto golxzn::os::filesystem::read_shared_text (const std::wstring_view path) -> std::enable_if_t< std::is_constructible_v< Custom, std::string >, std::shared_ptr< Custom > >
 Construct std::shared_ptr<Custom> by binary data from file.
 
template<class Custom >
static auto golxzn::os::filesystem::read_unique_binary (const std::wstring_view path) -> std::enable_if_t< std::is_constructible_v< Custom, std::vector< byte > >, std::unique_ptr< Custom > >
 Construct std::shared_ptr<Custom> by binary data from file.
 
template<class Custom >
static auto golxzn::os::filesystem::read_unique_text (const std::wstring_view path) -> std::enable_if_t< std::is_constructible_v< Custom, std::string >, std::unique_ptr< Custom > >
 Construct std::shared_ptr<Custom> by binary data from file.
 

Detailed Description

Function Documentation

◆ read_binary() [1/2]

static std::vector< byte > golxzn::os::filesystem::read_binary ( const std::wstring_view  path)
static

Read whole binary file.

Warning
This method throws an exception std::invalid_argument if the path has no protocol!
Parameters
pathPath to the file
Returns
std::vector<byte> - The data or an empty vector if there's an reading error.

◆ read_binary() [2/2]

template<class Custom >
auto golxzn::os::filesystem::read_binary ( const std::wstring_view  path) -> std::enable_if_t<std::is_constructible_v<Custom, std::vector<byte>>, Custom>
static

Construct Custom class by binary data from file.

Template Parameters
CustomClass to construct. Has to have a constructor with std::vector<byte> argument
Parameters
pathPath to the file
Returns
Custom - Constructed class

◆ read_shared_binary()

template<class Custom >
auto golxzn::os::filesystem::read_shared_binary ( const std::wstring_view  path) -> std::enable_if_t<std::is_constructible_v<Custom, std::vector<byte>>, std::shared_ptr<Custom>>
static

Construct std::shared_ptr<Custom> by binary data from file.

Template Parameters
CustomClass to construct. Has to have a public constructor with std::vector<byte> argument
Parameters
pathPath to the file
Returns
std::shared_ptr<Custom> - Constructed shared class

◆ read_shared_text()

template<class Custom >
auto golxzn::os::filesystem::read_shared_text ( const std::wstring_view  path) -> std::enable_if_t<std::is_constructible_v<Custom, std::string>, std::shared_ptr<Custom>>
static

Construct std::shared_ptr<Custom> by binary data from file.

Template Parameters
CustomClass to construct. Has to have a public constructor with std::string argument
Parameters
pathPath to the file
Returns
std::shared_ptr<Custom> - Constructed shared class

◆ read_text() [1/2]

static std::string golxzn::os::filesystem::read_text ( const std::wstring_view  path)
static

Read whole text file.

Warning
This method throws an exception std::invalid_argument if the path has no protocol!
Parameters
pathPath to the file
Returns
std::string - The data or an empty string if there's an reading error.

◆ read_text() [2/2]

template<class Custom >
auto golxzn::os::filesystem::read_text ( const std::wstring_view  path) -> std::enable_if_t<std::is_constructible_v<Custom, std::string>, Custom>
static

Construct Custom class by text data from file.

Template Parameters
CustomClass to construct. Has to have a constructor with std::string argument
Parameters
pathPath to the file
Returns
Custom - Constructed class

◆ read_unique_binary()

template<class Custom >
auto golxzn::os::filesystem::read_unique_binary ( const std::wstring_view  path) -> std::enable_if_t<std::is_constructible_v<Custom, std::vector<byte>>, std::unique_ptr<Custom>>
static

Construct std::shared_ptr<Custom> by binary data from file.

Template Parameters
CustomClass to construct. Has to have a public constructor with std::vector<byte> argument
Parameters
pathPath to the file
Returns
std::unique_ptr<Custom> - Constructed unique class

◆ read_unique_text()

template<class Custom >
auto golxzn::os::filesystem::read_unique_text ( const std::wstring_view  path) -> std::enable_if_t<std::is_constructible_v<Custom, std::string>, std::unique_ptr<Custom>>
static

Construct std::shared_ptr<Custom> by binary data from file.

Template Parameters
CustomClass to construct. Has to have a public constructor with std::string argument
Parameters
pathPath to the file
Returns
std::unique_ptr<Custom> - Constructed unique class