Skip to content

Commit

Permalink
Fix doc and format detection
Browse files Browse the repository at this point in the history
  • Loading branch information
rikyoz committed Sep 3, 2019
1 parent 9aef0eb commit 6f4149b
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 29 deletions.
15 changes: 15 additions & 0 deletions include/bitarchiveinfo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ namespace bit7z {
/**
* @brief Constructs a BitArchiveInfo object, opening the input file archive.
*
* @note When bit7z is compiled using the BIT7Z_AUTO_FORMAT macro define, the format
* argument has default value BitFormat::Auto (automatic format detection of the input archive).
* On the other hand, when BIT7Z_AUTO_FORMAT is not defined (i.e. no auto format detection available)
* the format argument must be specified.
*
* @param lib the 7z library used.
* @param in_file the input archive file path.
* @param format the input archive format.
Expand All @@ -48,6 +53,11 @@ namespace bit7z {
/**
* @brief Constructs a BitArchiveInfo object, opening the archive in the input buffer.
*
* @note When bit7z is compiled using the BIT7Z_AUTO_FORMAT macro define, the format
* argument has default value BitFormat::Auto (automatic format detection of the input archive).
* On the other hand, when BIT7Z_AUTO_FORMAT is not defined (i.e. no auto format detection available)
* the format argument must be specified.
*
* @param lib the 7z library used.
* @param in_buffer the input buffer containing the archive.
* @param format the input archive format.
Expand All @@ -59,6 +69,11 @@ namespace bit7z {
/**
* @brief Constructs a BitArchiveInfo object, opening the archive from the standard input stream.
*
* @note When bit7z is compiled using the BIT7Z_AUTO_FORMAT macro define, the format
* argument has default value BitFormat::Auto (automatic format detection of the input archive).
* On the other hand, when BIT7Z_AUTO_FORMAT is not defined (i.e. no auto format detection available)
* the format argument must be specified.
*
* @param lib the 7z library used.
* @param in_stream the standard input stream of the archive.
* @param format the input archive format.
Expand Down
7 changes: 6 additions & 1 deletion include/bitextractor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ namespace bit7z {
* of the 7z DLLs. On the other hand, the BitInFormat is required in order to know the
* format of the input archive.
*
* @note When bit7z is compiled using the BIT7Z_AUTO_FORMAT macro define, the format
* argument has default value BitFormat::Auto (automatic format detection of the input archive).
* On the other hand, when BIT7Z_AUTO_FORMAT is not defined (i.e. no auto format detection available)
* the format argument must be specified.
*
* @param lib the 7z library used.
* @param format the input archive format.
*/
Expand Down Expand Up @@ -101,7 +106,7 @@ namespace bit7z {
* @brief Extracts a file from the given archive into the output stream.
*
* @param in_file the input archive file.
* @param out_stream the output standard stream where the content of the archive will be put.
* @param out_stream the (binary) stream where the content of the archive will be put.
* @param index the index of the file to be extracted from in_file.
*/
void extract( const wstring& in_file, ostream& out_stream, unsigned int index = 0 ) const;
Expand Down
2 changes: 1 addition & 1 deletion include/bitmemcompressor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ namespace bit7z {
* @note If the format of the output doesn't support in memory compression, a BitException is thrown.
*
* @param in_buffer the buffer to be compressed.
* @param out_stream the standard stream going to contain the output archive.
* @param out_stream the (binary) stream going to contain the output archive.
* @param in_buffer_name (optional) the buffer name used to give a name to the content of the archive.
*/
void compress( const vector< byte_t >& in_buffer,
Expand Down
9 changes: 7 additions & 2 deletions include/bitmemextractor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,15 @@ namespace bit7z {
* of the 7z DLLs. On the other hand, the BitInFormat is required in order to know the
* format of the input archive.
*
* @note When bit7z is compiled using the BIT7Z_AUTO_FORMAT macro define, the format
* argument has default value BitFormat::Auto (automatic format detection of the input archive).
* On the other hand, when BIT7Z_AUTO_FORMAT is not defined (i.e. no auto format detection available)
* the format argument must be specified.
*
* @param lib the 7z library used.
* @param format the input archive format.
*/
BitMemExtractor( const Bit7zLibrary& lib, const BitInFormat& format );
BitMemExtractor( const Bit7zLibrary& lib, const BitInFormat& format DEFAULT_FORMAT );

/**
* @brief Extracts the given buffer archive into the choosen directory.
Expand All @@ -63,7 +68,7 @@ namespace bit7z {
* @brief Extracts the given buffer archive into the output standard stream.
*
* @param in_buffer the buffer containing the archive to be extracted.
* @param out_stream the output standard stream where the content of the archive will be put.
* @param out_stream the (binary) stream where the content of the archive will be put.
* @param index the index of the file to be extracted from in_buffer.
*/
void extract( const vector< byte_t >& in_buffer, ostream& out_stream, unsigned int index = 0 ) const;
Expand Down
8 changes: 4 additions & 4 deletions include/bitstreamcompressor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ namespace bit7z {
/**
* @brief Compresses the given standard istream to the standard ostream.
*
* @param in_stream the standard istream to be compressed.
* @param out_stream the standard ostream where the archive will be output.
* @param in_stream the (binary) stream to be compressed.
* @param out_stream the (binary) stream where the archive will be output.
* @param in_stream_name (optional) the name to be used for the content of the archive.
*/
void compress( istream& in_stream, ostream& out_stream, const wstring& in_stream_name = L"" ) const;

/**
* @brief Compresses the given standard istream to the output buffer.
*
* @param in_stream the standard istream to be compressed.
* @param in_stream the (binary) stream to be compressed.
* @param out_buffer the buffer going to contain the output archive.
* @param in_stream_name (optional) the name to be used for the content of the archive.
*/
Expand All @@ -43,7 +43,7 @@ namespace bit7z {
/**
* @brief Compresses the given standard istream to an archive on the filesystem.
*
* @param in_stream the standard istream to be compressed.
* @param in_stream the (binary) stream to be compressed.
* @param out_file the output archive file path.
* @param in_stream_name (optional) the name to be used for the content of the archive.
*/
Expand Down
19 changes: 12 additions & 7 deletions include/bitstreamextractor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,28 @@ namespace bit7z {
* of the 7z DLLs. On the other hand, the BitInFormat is required in order to know the
* format of the input archive.
*
* @note When bit7z is compiled using the BIT7Z_AUTO_FORMAT macro define, the format
* argument has default value BitFormat::Auto (automatic format detection of the input archive).
* On the other hand, when BIT7Z_AUTO_FORMAT is not defined (i.e. no auto format detection available)
* the format argument must be specified.
*
* @param lib the 7z library used.
* @param format the input archive format.
*/
BitStreamExtractor( const Bit7zLibrary& lib, const BitInFormat& format );
BitStreamExtractor( const Bit7zLibrary& lib, const BitInFormat& format DEFAULT_FORMAT );

/**
* @brief Extracts the given stream archive into the choosen directory.
*
* @param in_stream the stream containing the archive to be extracted.
* @param in_stream the (binary) stream containing the archive to be extracted.
* @param out_dir the output directory where to put the file extracted.
*/
void extract( istream& in_stream, const wstring& out_dir = L"" ) const;

/**
* @brief Extracts the given stream archive into the output buffer.
*
* @param in_stream the stream containing the archive to be extracted.
* @param in_stream the (binary) stream containing the archive to be extracted.
* @param out_buffer the output buffer where the content of the archive will be put.
* @param index the index of the file to be extracted from in_buffer.
*/
Expand All @@ -62,8 +67,8 @@ namespace bit7z {
/**
* @brief Extracts the given stream archive into the output standard stream.
*
* @param in_stream the stream containing the archive to be extracted.
* @param out_stream the output standard stream where the content of the archive will be put.
* @param in_stream the (binary) stream containing the archive to be extracted.
* @param out_stream the (binary) output stream where the content of the archive will be put.
* @param index the index of the file to be extracted from in_buffer.
*/
void extract( istream& in_stream, ostream& out_stream, unsigned int index = 0 ) const;
Expand All @@ -72,7 +77,7 @@ namespace bit7z {
* @brief Extracts the given stream archive into a map of memory buffers, where keys are the paths
* of the files (inside the archive) and values are the corresponding decompressed contents.
*
* @param in_stream the stream containing the archive to be extracted.
* @param in_stream the (binary) stream containing the archive to be extracted.
* @param out_map the output map.
*/
void extract( istream& in_stream, map< wstring, vector< byte_t > >& out_map ) const;
Expand All @@ -82,7 +87,7 @@ namespace bit7z {
*
* If the input archive is not valid, a BitException is thrown.
*
* @param in_stream the stream containing the archive to be tested.
* @param in_stream the (binary) stream containing the archive to be tested.
*/
void test( istream& in_stream ) const;
};
Expand Down
8 changes: 1 addition & 7 deletions src/bitmemextractor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,7 @@
using namespace bit7z;

BitMemExtractor::BitMemExtractor( const Bit7zLibrary& lib, const BitInFormat& format )
: BitArchiveOpener( lib, format ) {
#ifdef BIT7Z_AUTO_FORMAT
if ( format == BitFormat::Auto ) {
throw BitException( "Automatic format detection not supported for in-memory archives", E_INVALIDARG );
}
#endif
}
: BitArchiveOpener( lib, format ) {}

void BitMemExtractor::extract( const vector< byte_t >& in_buffer, const wstring& out_dir ) const {
BitInputArchive in_archive( *this, in_buffer );
Expand Down
8 changes: 1 addition & 7 deletions src/bitstreamextractor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,7 @@
using namespace bit7z;

BitStreamExtractor::BitStreamExtractor( const Bit7zLibrary& lib, const BitInFormat& format )
: BitArchiveOpener( lib, format ) {
#ifdef BIT7Z_AUTO_FORMAT
if ( format == BitFormat::Auto ) {
throw BitException( "Automatic format detection not supported for in-memory archives", E_INVALIDARG );
}
#endif
}
: BitArchiveOpener( lib, format ) {}

void BitStreamExtractor::extract( istream& in_stream, const wstring& out_dir ) const {
BitInputArchive in_archive( *this, in_stream );
Expand Down

0 comments on commit 6f4149b

Please sign in to comment.