modernization

This commit is contained in:
Günter Obiltschnig 2020-01-10 12:50:28 +01:00
parent b55db12286
commit 54089b4523
6 changed files with 16 additions and 13 deletions

View File

@ -36,11 +36,13 @@ class Zip_API Decompress: public ParseCallback
/// Decompress extracts files from zip files, can be used to extract single files or all files /// Decompress extracts files from zip files, can be used to extract single files or all files
{ {
public: public:
typedef std::map<std::string, Poco::Path> ZipMapping; using ZipMapping = std::map<std::string, Poco::Path>;
/// Maps key of FileInfo entries to their local decompressed representation /// Maps key of FileInfo entries to their local decompressed representation
Poco::FIFOEvent<std::pair<const ZipLocalFileHeader, const std::string> > EError;
Poco::FIFOEvent<std::pair<const ZipLocalFileHeader, const std::string>> EError;
/// Thrown whenever an error is detected when handling a ZipLocalFileHeader entry. The string contains an error message /// Thrown whenever an error is detected when handling a ZipLocalFileHeader entry. The string contains an error message
Poco::FIFOEvent<std::pair<const ZipLocalFileHeader, const Poco::Path> > EOk;
Poco::FIFOEvent<std::pair<const ZipLocalFileHeader, const Poco::Path>> EOk;
/// Thrown whenever a file was successfully decompressed /// Thrown whenever a file was successfully decompressed
Decompress(std::istream& in, const Poco::Path& outputDir, bool flattenDirs = false, bool keepIncompleteFiles = false); Decompress(std::istream& in, const Poco::Path& outputDir, bool flattenDirs = false, bool keepIncompleteFiles = false);

View File

@ -38,10 +38,10 @@ class Zip_API ZipArchive
/// A ZipArchive contains information on the content of a zip file /// A ZipArchive contains information on the content of a zip file
{ {
public: public:
typedef std::map<std::string, ZipLocalFileHeader> FileHeaders; using FileHeaders = std::map<std::string, ZipLocalFileHeader>;
typedef std::map<std::string, ZipFileInfo> FileInfos; using FileInfos = std::map<std::string, ZipFileInfo>;
typedef std::map<Poco::UInt16, ZipArchiveInfo> DirectoryInfos; using DirectoryInfos = std::map<Poco::UInt16, ZipArchiveInfo>;
typedef std::map<Poco::UInt32, ZipArchiveInfo64> DirectoryInfos64; using DirectoryInfos64 = std::map<Poco::UInt32, ZipArchiveInfo64>;
ZipArchive(std::istream& in); ZipArchive(std::istream& in);
/// Creates the ZipArchive from a file. Note that the in stream will be in state failed after the constructor is finished /// Creates the ZipArchive from a file. Note that the in stream will be in state failed after the constructor is finished

View File

@ -88,7 +88,7 @@ private:
/// Compresses the new file to outFile /// Compresses the new file to outFile
private: private:
typedef std::map<std::string, ZipOperation::Ptr> Changes; using Changes = std::map<std::string, ZipOperation::Ptr>;
const std::string _zipFile; const std::string _zipFile;
bool _backupOriginalFile; bool _backupOriginalFile;

View File

@ -36,7 +36,7 @@ class Zip_API ZipOperation: public Poco::RefCountedObject
/// Abstract super class for operations on individual zip entries /// Abstract super class for operations on individual zip entries
{ {
public: public:
typedef Poco::AutoPtr<ZipOperation> Ptr; using Ptr = Poco::AutoPtr<ZipOperation>;
ZipOperation(); ZipOperation();
/// Creates the ZipOperation. /// Creates the ZipOperation.

View File

@ -65,8 +65,9 @@ private:
STREAM_BUFFER_SIZE = 1024 STREAM_BUFFER_SIZE = 1024
}; };
typedef Poco::SharedPtr<std::istream> PtrIStream; using PtrIStream = Poco::SharedPtr<std::istream>;
typedef Poco::SharedPtr<std::ostream> PtrOStream; using PtrOStream = Poco::SharedPtr<std::ostream>;
std::istream* _pIstr; std::istream* _pIstr;
std::ostream* _pOstr; std::ostream* _pOstr;
PtrIStream _ptrBuf; PtrIStream _ptrBuf;

View File

@ -46,7 +46,7 @@ Decompress::Decompress(std::istream& in, const Poco::Path& outputDir, bool flatt
} }
if (!tmp.isDirectory()) if (!tmp.isDirectory())
throw Poco::IOException("Failed to create/open directory: " + _outDir.toString()); throw Poco::IOException("Failed to create/open directory: " + _outDir.toString());
EOk += Poco::Delegate<Decompress, std::pair<const ZipLocalFileHeader, const Poco::Path> >(this, &Decompress::onOk); EOk += Poco::Delegate<Decompress, std::pair<const ZipLocalFileHeader, const Poco::Path>>(this, &Decompress::onOk);
} }
@ -55,7 +55,7 @@ Decompress::~Decompress()
{ {
try try
{ {
EOk -= Poco::Delegate<Decompress, std::pair<const ZipLocalFileHeader, const Poco::Path> >(this, &Decompress::onOk); EOk -= Poco::Delegate<Decompress, std::pair<const ZipLocalFileHeader, const Poco::Path>>(this, &Decompress::onOk);
} }
catch (...) catch (...)
{ {