1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 08:47:17 +01:00
SqMod/vendor/POCO/Net/include/Poco/Net/FilePartSource.h
Sandu Liviu Catalin 4a6bfc086c 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.
2021-01-30 08:51:39 +02:00

78 lines
1.8 KiB
C++

//
// FilePartSource.h
//
// Library: Net
// Package: Messages
// Module: FilePartSource
//
// Definition of the FilePartSource class.
//
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Net_FilePartSource_INCLUDED
#define Net_FilePartSource_INCLUDED
#include "Poco/Net/Net.h"
#include "Poco/Net/PartSource.h"
#include "Poco/FileStream.h"
namespace Poco {
namespace Net {
class Net_API FilePartSource: public PartSource
/// An implementation of PartSource for
/// plain files.
{
public:
FilePartSource(const std::string& path);
/// Creates the FilePartSource for the given path.
///
/// The MIME type is set to application/octet-stream.
///
/// Throws an OpenFileException if the file cannot be opened.
FilePartSource(const std::string& path, const std::string& mediaType);
/// Creates the FilePartSource for the given
/// path and MIME type.
///
/// Throws an OpenFileException if the file cannot be opened.
FilePartSource(const std::string& path, const std::string& filename, const std::string& mediaType);
/// Creates the FilePartSource for the given
/// path and MIME type. The given filename is
/// used as part filename (see filename()) only.
///
/// Throws an OpenFileException if the file cannot be opened.
~FilePartSource();
/// Destroys the FilePartSource.
std::istream& stream();
/// Returns a file input stream for the given file.
const std::string& filename() const;
/// Returns the filename portion of the path.
std::streamsize getContentLength() const;
/// Returns the file size.
private:
std::string _path;
std::string _filename;
Poco::FileInputStream _istr;
};
} } // namespace Poco::Net
#endif // Net_FilePartSource_INCLUDED