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
{
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
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
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
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
{
public:
typedef std::map<std::string, ZipLocalFileHeader> FileHeaders;
typedef std::map<std::string, ZipFileInfo> FileInfos;
typedef std::map<Poco::UInt16, ZipArchiveInfo> DirectoryInfos;
typedef std::map<Poco::UInt32, ZipArchiveInfo64> DirectoryInfos64;
using FileHeaders = std::map<std::string, ZipLocalFileHeader>;
using FileInfos = std::map<std::string, ZipFileInfo>;
using DirectoryInfos = std::map<Poco::UInt16, ZipArchiveInfo>;
using DirectoryInfos64 = std::map<Poco::UInt32, ZipArchiveInfo64>;
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

View File

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

View File

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

View File

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

View File

@ -46,7 +46,7 @@ Decompress::Decompress(std::istream& in, const Poco::Path& outputDir, bool flatt
}
if (!tmp.isDirectory())
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
{
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 (...)
{