Nui
Public Member Functions | Friends | List of all members
Nui::AsyncFile Class Reference

Do note that the use of this class is inefficient. More...

#include <file.hpp>

Public Member Functions

 ~AsyncFile ()
 
void tellg (std::function< void(int32_t)> cb) const
 
void tellp (std::function< void(int32_t)> cb) const
 
void seekg (int32_t pos, std::function< void()> cb, std::ios_base::seekdir dir=std::ios_base::beg)
 
void seekp (int32_t pos, std::function< void()> cb, std::ios_base::seekdir dir=std::ios_base::beg)
 
void read (int32_t size, std::function< void(std::string &&)> cb)
 
void readAll (std::function< void(std::string &&)> cb)
 
void write (std::string const &data, std::function< void()> cb)
 

Friends

void openFile (char const *filename, std::ios_base::openmode mode, std::function< void(std::optional< AsyncFile > &&)> onOpen)
 
void openFile (std::string const &filename, std::ios_base::openmode mode, std::function< void(std::optional< AsyncFile > &&)> onOpen)
 
void openFile (std::filesystem::path const &filename, std::ios_base::openmode mode, std::function< void(std::optional< AsyncFile > &&)> onOpen)
 

Detailed Description

Do note that the use of this class is inefficient.

Prefer implementing your file logic on the backend and pass functions with broader scope through to the frontend.

Constructor & Destructor Documentation

◆ ~AsyncFile()

Nui::AsyncFile::~AsyncFile ( )

Member Function Documentation

◆ read()

void Nui::AsyncFile::read ( int32_t  size,
std::function< void(std::string &&)>  cb 
)

◆ readAll()

void Nui::AsyncFile::readAll ( std::function< void(std::string &&)>  cb)

◆ seekg()

void Nui::AsyncFile::seekg ( int32_t  pos,
std::function< void()>  cb,
std::ios_base::seekdir  dir = std::ios_base::beg 
)

◆ seekp()

void Nui::AsyncFile::seekp ( int32_t  pos,
std::function< void()>  cb,
std::ios_base::seekdir  dir = std::ios_base::beg 
)

◆ tellg()

void Nui::AsyncFile::tellg ( std::function< void(int32_t)>  cb) const

◆ tellp()

void Nui::AsyncFile::tellp ( std::function< void(int32_t)>  cb) const

◆ write()

void Nui::AsyncFile::write ( std::string const &  data,
std::function< void()>  cb 
)

Friends And Related Function Documentation

◆ openFile [1/3]

void openFile ( char const *  filename,
std::ios_base::openmode  mode,
std::function< void(std::optional< AsyncFile > &&)>  onOpen 
)
friend

◆ openFile [2/3]

void openFile ( std::filesystem::path const &  filename,
std::ios_base::openmode  mode,
std::function< void(std::optional< AsyncFile > &&)>  onOpen 
)
friend

◆ openFile [3/3]

void openFile ( std::string const &  filename,
std::ios_base::openmode  mode,
std::function< void(std::optional< AsyncFile > &&)>  onOpen 
)
friend

The documentation for this class was generated from the following files: