Skip to content

BitItemsVector

Oz edited this page Sep 25, 2024 · 7 revisions

The BitItemsVector class represents a vector of generic input items, i.e., items that can come from the filesystem, from memory buffers, or from standard streams.

#include <bit7z/bititemsvector.hpp>

List of all members

Public Members

Return type Name
GenericInputItemVector::const_iterator begin() const noexcept
GenericInputItemVector::const_iterator cbegin() const noexcept
GenericInputItemVector::const_iterator cend() const noexcept
GenericInputItemVector::const_iterator end() const noexcept
void indexBuffer( const std::vector< byte_t >& inBuffer, const tstring& name )
void indexDirectory( const fs::path& inDir, const tstring& filter = {}, FilterPolicy policy = FilterPolicy::Include, IndexingOptions options = {} )
void indexFile( const tstring& inFile, const tstring& name = {}, bool followSymlinks = true )
void indexPaths( const std::vector< tstring >& inPaths, IndexingOptions options = {} )
void indexPathsMap( const std::map< tstring, tstring >& inPaths, IndexingOptions options = {} )
void indexStream( std::istream& inStream, const tstring& name )
const GenericInputItem & operator[]( GenericInputItemVector::size_type index ) const
std::size_t size() const

Member Function Documentation

GenericInputItemVector::const_iterator begin() const noexcept

Returns an iterator to the first element of the vector; if the vector is empty, the returned iterator will be equal to the end() iterator.


GenericInputItemVector::const_iterator cbegin() const noexcept

Returns an iterator to the first element of the vector; if the vector is empty, the returned iterator will be equal to the end() iterator.


GenericInputItemVector::const_iterator cend() const noexcept

Returns an iterator to the element following the last element of the vector; this element acts as a placeholder: attempting to access it results in undefined behavior.


GenericInputItemVector::const_iterator end() const noexcept

Returns an iterator to the element following the last element of the vector; this element acts as a placeholder: attempting to access it results in undefined behavior.


void indexBuffer( const std::vector< byte_t >& inBuffer, const tstring& name )

Indexes the given buffer, using the given name as a path when compressed in archives.

Parameters:

  • inBuffer: the buffer containing the file to be indexed in the vector.
  • name: user-defined path to be used inside archives.

void indexDirectory( const fs::path& inDir, const tstring& filter = {}, FilterPolicy policy = FilterPolicy::Include, IndexingOptions options = {} )

Indexes the given directory, adding to the vector all the files that match the wildcard filter.

Parameters:

  • inDir: the directory to be indexed.
  • filter: (optional) the wildcard filter to be used for indexing; empty string means "index all files".
  • policy: (optional) the filtering policy to be applied to the matched items.
  • options: (optional) the settings to be used while indexing the given directory and all of its subdirectories.

void indexFile( const tstring& inFile, const tstring& name = {}, bool followSymlinks = true )

Indexes the given file path, with an optional user-defined path to be used in output archives.

Note

If a directory path is given, a BitException is thrown.

Parameters:

  • inFile: the path to the filesystem file to be indexed in the vector.
  • name: (optional) user-defined path to be used inside archives.
  • followSymlinks: (optional) whether to follow symbolic links or not.

void indexPaths( const std::vector< tstring >& inPaths, IndexingOptions options = {} )

Indexes the given vector of filesystem paths, adding to the item vector all the files.

Parameters:

  • inPaths: the vector of filesystem paths.
  • options: (optional) the settings to be used while indexing the given directory and all of its subdirectories.

void indexPathsMap( const std::map< tstring, tstring >& inPaths, IndexingOptions options = {} )

Indexes the given map of filesystem paths, adding to the vector all the files.

Note

Map keys represent the filesystem paths to be indexed; the corresponding mapped values are the user-defined (possibly different) paths wanted inside archives.

Parameters:

  • inPaths: map of filesystem paths with the corresponding user-defined path desired inside the output archive.
  • options: (optional) the settings to be used while indexing the given directory and all of its subdirectories.

void indexStream( std::istream& inStream, const tstring& name )

Indexes the given standard input stream, using the given name as a path when compressed in archives.

Parameters:

  • inStream: the standard input stream of the file to be indexed in the vector.
  • name: user-defined path to be used inside archives.

const GenericInputItem & operator[]( GenericInputItemVector::size_type index ) const

Parameters:

  • index: the index of the desired item in the vector.

Returns a constant reference to the GenericInputItem at the given index.


std::size_t size() const

Returns the size of the items vector.


Clone this wiki locally