mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-07-03 07:27:11 +02:00
Major plugin refactor and cleanup.
Switched to POCO library for unified platform/library interface. Deprecated the external module API. It was creating more problems than solving. Removed most built-in libraries in favor of system libraries for easier maintenance. Cleaned and secured code with help from static analyzers.
This commit is contained in:
119
vendor/POCO/SevenZip/include/Poco/SevenZip/Archive.h
vendored
Normal file
119
vendor/POCO/SevenZip/include/Poco/SevenZip/Archive.h
vendored
Normal file
@ -0,0 +1,119 @@
|
||||
//
|
||||
// Archive.h
|
||||
//
|
||||
// Library: SevenZip
|
||||
// Package: Archive
|
||||
// Module: Archive
|
||||
//
|
||||
// Definition of the Archive class.
|
||||
//
|
||||
// Copyright (c) 2014, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef SevenZip_Archive_INCLUDED
|
||||
#define SevenZip_Archive_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/SevenZip/SevenZip.h"
|
||||
#include "Poco/SevenZip/ArchiveEntry.h"
|
||||
#include "Poco/BasicEvent.h"
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace SevenZip {
|
||||
|
||||
|
||||
class ArchiveImpl;
|
||||
|
||||
|
||||
class SevenZip_API Archive
|
||||
/// This class represents a 7-Zip archive.
|
||||
///
|
||||
/// The Archive class can be used to enumerate entries in a
|
||||
/// 7-Zip archive, and to extract files or directories from
|
||||
/// an archive.
|
||||
{
|
||||
public:
|
||||
typedef std::vector<ArchiveEntry> EntryVec;
|
||||
typedef EntryVec::iterator Iterator;
|
||||
typedef EntryVec::const_iterator ConstIterator;
|
||||
|
||||
struct ExtractedEventArgs
|
||||
{
|
||||
ArchiveEntry entry;
|
||||
std::string extractedPath;
|
||||
};
|
||||
|
||||
struct FailedEventArgs
|
||||
{
|
||||
ArchiveEntry entry;
|
||||
Poco::Exception* pException;
|
||||
};
|
||||
|
||||
Poco::BasicEvent<const ExtractedEventArgs> extracted;
|
||||
/// Fired when an archive entry has been successfully extracted.
|
||||
|
||||
Poco::BasicEvent<const FailedEventArgs> failed;
|
||||
/// Fired when extracting an archive entry failed.
|
||||
|
||||
Archive(const std::string& path);
|
||||
/// Creates an Archive object for the 7-Zip archive
|
||||
/// with the given path.
|
||||
|
||||
~Archive();
|
||||
/// Destroys the Archive.
|
||||
|
||||
const std::string& path() const;
|
||||
/// Returns the path of the archive in the filesystem.
|
||||
|
||||
std::size_t size() const;
|
||||
/// Returns the number of entries in the archive.
|
||||
|
||||
ConstIterator begin() const;
|
||||
/// Returns an iterator for iterating over the
|
||||
/// file or directory entries in the archive.
|
||||
|
||||
ConstIterator end() const;
|
||||
/// Returns the end iterator.
|
||||
|
||||
void extract(const std::string& destPath);
|
||||
/// Extracts the entire archive to the given path.
|
||||
///
|
||||
/// Directories will be created as necessary. File attributes
|
||||
/// will not be restored.
|
||||
///
|
||||
/// Progress and errors for single entries will be reported
|
||||
/// via the extracted and failed events.
|
||||
|
||||
std::string extract(const ArchiveEntry& entry, const std::string& destPath);
|
||||
/// Extracts a specific entry to the given path.
|
||||
///
|
||||
/// Directories will be created as necessary. File attributes
|
||||
/// will not be restored.
|
||||
///
|
||||
/// Returns the absolute path of the extracted entry.
|
||||
|
||||
private:
|
||||
Archive();
|
||||
Archive(const Archive&);
|
||||
Archive& operator = (const Archive&);
|
||||
|
||||
ArchiveImpl* _pImpl;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// inlines
|
||||
//
|
||||
|
||||
|
||||
} } // namespace Poco::SevenZip
|
||||
|
||||
|
||||
#endif // SevenZip_ArchiveEntry_INCLUDED
|
164
vendor/POCO/SevenZip/include/Poco/SevenZip/ArchiveEntry.h
vendored
Normal file
164
vendor/POCO/SevenZip/include/Poco/SevenZip/ArchiveEntry.h
vendored
Normal file
@ -0,0 +1,164 @@
|
||||
//
|
||||
// ArchiveEntry.h
|
||||
//
|
||||
// Library: SevenZip
|
||||
// Package: Archive
|
||||
// Module: ArchiveEntry
|
||||
//
|
||||
// Definition of the ArchiveEntry class.
|
||||
//
|
||||
// Copyright (c) 2014, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef SevenZip_ArchiveEntry_INCLUDED
|
||||
#define SevenZip_ArchiveEntry_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/SevenZip/SevenZip.h"
|
||||
#include "Poco/Timestamp.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace SevenZip {
|
||||
|
||||
|
||||
class SevenZip_API ArchiveEntry
|
||||
/// This class represents an entry in 7-Zip archive. The entry can
|
||||
/// be a file or a directory, with a path, modification date/time,
|
||||
/// original size and file attributes.
|
||||
///
|
||||
/// File attributes are based on those supported on Windows and are
|
||||
/// not of much use on non-Windows platforms.
|
||||
{
|
||||
public:
|
||||
enum EntryType
|
||||
{
|
||||
ENTRY_FILE = 0, /// The entry represents an ordinary file.
|
||||
ENTRY_DIRECTORY = 1 /// The entry represents a directory.
|
||||
};
|
||||
|
||||
enum EntryAttributes
|
||||
{
|
||||
ATTR_READONLY = 0x01, /// The file or directory is read-only.
|
||||
ATTR_HIDDEN = 0x02, /// The file or directory is hidden.
|
||||
ATTR_SYSTEM = 0x04, /// The file or directory is used by the operating system.
|
||||
ATTR_DIRECTORY = 0x10, /// The entry is a directory.
|
||||
ATTR_ARCHIVE = 0x20 /// The file or directory is marked for backup or removal.
|
||||
};
|
||||
|
||||
ArchiveEntry();
|
||||
/// Creates an empty ArchiveEntry;
|
||||
|
||||
ArchiveEntry(const ArchiveEntry& entry);
|
||||
/// Creates an ArchiveEntry by copying another one.
|
||||
|
||||
~ArchiveEntry();
|
||||
/// Destroys the ArchiveEntry.
|
||||
|
||||
ArchiveEntry& operator = (const ArchiveEntry& entry);
|
||||
/// Assignment operator.
|
||||
|
||||
void swap(ArchiveEntry& entry);
|
||||
/// Swaps the entry with another one.
|
||||
|
||||
EntryType type() const;
|
||||
/// Returns the type of the entry.
|
||||
|
||||
const std::string& path() const;
|
||||
/// Return the UTF-8 encoded path.
|
||||
|
||||
Poco::UInt64 size() const;
|
||||
/// Returns the original size of the file.
|
||||
|
||||
Poco::Timestamp lastModified() const;
|
||||
/// Returns the date and time of last modification.
|
||||
|
||||
Poco::UInt32 attributes() const;
|
||||
/// Returns the entry attributes as a bitmask.
|
||||
///
|
||||
/// See the EntryAttributes enumeration for valid values.
|
||||
|
||||
bool isFile() const;
|
||||
/// Returns true iff the entry represents a file.
|
||||
|
||||
bool isDirectory() const;
|
||||
/// Returns true iff the entry represents a directory.
|
||||
|
||||
protected:
|
||||
ArchiveEntry(EntryType type, const std::string& path, Poco::UInt64 size, Poco::Timestamp lastModified, Poco::UInt32 attributes, Poco::UInt32 index);
|
||||
/// Creates an ArchiveEntry.
|
||||
|
||||
Poco::UInt32 index() const;
|
||||
/// Returns the index of the entry within the archive.
|
||||
|
||||
private:
|
||||
EntryType _type;
|
||||
std::string _path;
|
||||
Poco::UInt64 _size;
|
||||
Poco::Timestamp _lastModified;
|
||||
Poco::UInt32 _attributes;
|
||||
Poco::UInt32 _index;
|
||||
|
||||
friend class ArchiveImpl;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// inlines
|
||||
//
|
||||
inline ArchiveEntry::EntryType ArchiveEntry::type() const
|
||||
{
|
||||
return _type;
|
||||
}
|
||||
|
||||
|
||||
inline const std::string& ArchiveEntry::path() const
|
||||
{
|
||||
return _path;
|
||||
}
|
||||
|
||||
|
||||
inline Poco::UInt64 ArchiveEntry::size() const
|
||||
{
|
||||
return _size;
|
||||
}
|
||||
|
||||
|
||||
inline Poco::Timestamp ArchiveEntry::lastModified() const
|
||||
{
|
||||
return _lastModified;
|
||||
}
|
||||
|
||||
|
||||
inline Poco::UInt32 ArchiveEntry::attributes() const
|
||||
{
|
||||
return _attributes;
|
||||
}
|
||||
|
||||
|
||||
inline Poco::UInt32 ArchiveEntry::index() const
|
||||
{
|
||||
return _index;
|
||||
}
|
||||
|
||||
|
||||
inline bool ArchiveEntry::isFile() const
|
||||
{
|
||||
return _type == ENTRY_FILE;
|
||||
}
|
||||
|
||||
|
||||
inline bool ArchiveEntry::isDirectory() const
|
||||
{
|
||||
return _type == ENTRY_DIRECTORY;
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::SevenZip
|
||||
|
||||
|
||||
#endif // SevenZip_ArchiveEntry_INCLUDED
|
62
vendor/POCO/SevenZip/include/Poco/SevenZip/SevenZip.h
vendored
Normal file
62
vendor/POCO/SevenZip/include/Poco/SevenZip/SevenZip.h
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
//
|
||||
// SevenZip.h
|
||||
//
|
||||
// Library: SevenZip
|
||||
// Package: SevenZip
|
||||
// Module: SevenZip
|
||||
//
|
||||
// Basic definitions for the Poco SevenZip library.
|
||||
// This file must be the first file included by every other SevenZip
|
||||
// header file.
|
||||
//
|
||||
// Copyright (c) 2014, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef SevenZip_SevenZip_INCLUDED
|
||||
#define SevenZip_SevenZip_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Foundation.h"
|
||||
|
||||
|
||||
//
|
||||
// The following block is the standard way of creating macros which make exporting
|
||||
// from a DLL simpler. All files within this DLL are compiled with the SevenZip_EXPORTS
|
||||
// symbol defined on the command line. this symbol should not be defined on any project
|
||||
// that uses this DLL. This way any other project whose source files include this file see
|
||||
// SevenZip_API functions as being imported from a DLL, wheras this DLL sees symbols
|
||||
// defined with this macro as being exported.
|
||||
//
|
||||
#if defined(_WIN32) && defined(POCO_DLL)
|
||||
#if defined(SevenZip_EXPORTS)
|
||||
#define SevenZip_API __declspec(dllexport)
|
||||
#else
|
||||
#define SevenZip_API __declspec(dllimport)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(SevenZip_API)
|
||||
#if !defined(POCO_NO_GCC_API_ATTRIBUTE) && defined (__GNUC__) && (__GNUC__ >= 4)
|
||||
#define SevenZip_API __attribute__ ((visibility ("default")))
|
||||
#else
|
||||
#define SevenZip_API
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
// Automatically link SevenZip library.
|
||||
//
|
||||
#if defined(_MSC_VER)
|
||||
#if !defined(POCO_NO_AUTOMATIC_LIBS) && !defined(SevenZip_EXPORTS)
|
||||
#pragma comment(lib, "PocoSevenZip" POCO_LIB_SUFFIX)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#endif // SevenZip_SevenZip_INCLUDED
|
Reference in New Issue
Block a user