Horizon
Public Member Functions | List of all members
libzip::file Class Reference

File for reading. More...

#include <zip.hpp>

Public Member Functions

 file (struct zip_file *file) noexcept
 Create a File with a zip_file structure. More...
 
 file (file &&other) noexcept=default
 Move constructor defaulted. More...
 
fileoperator= (file &&) noexcept=default
 Move operator defaulted. More...
 
int read (void *data, uint64_t length) noexcept
 Read some data. More...
 
template<size_t Size>
int read (char(&data)[Size]) noexcept
 Read some data to a fixed size array. More...
 
std::string read (uint64_t length)
 Optimized function for reading all characters with only one allocation. More...
 

Detailed Description

File for reading.

Constructor & Destructor Documentation

◆ file() [1/2]

libzip::file::file ( struct zip_file *  file)
inlinenoexcept

Create a File with a zip_file structure.

Parameters
filethe file ready to be used

◆ file() [2/2]

libzip::file::file ( file &&  other)
defaultnoexcept

Move constructor defaulted.

Parameters
otherthe other File

Member Function Documentation

◆ operator=()

file& libzip::file::operator= ( file &&  )
defaultnoexcept

Move operator defaulted.

Returns
*this

◆ read() [1/3]

template<size_t Size>
int libzip::file::read ( char(&)  data[Size])
inlinenoexcept

Read some data to a fixed size array.

Parameters
datathe array
Returns
the number of bytes written or -1 on failure

◆ read() [2/3]

std::string libzip::file::read ( uint64_t  length)
inline

Optimized function for reading all characters with only one allocation.

Ideal for combining with archive::stat.

Parameters
lengththe length of the file
Returns
the whole string
See also
archive::stat

◆ read() [3/3]

int libzip::file::read ( void *  data,
uint64_t  length 
)
inlinenoexcept

Read some data.

Parameters
datathe destination buffer
lengththe length
Returns
the number of bytes written or -1 on failure

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