/usr/include/Poco/Net/PartStore.h is in libpoco-dev 1.8.0.1-1ubuntu4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | //
// PartStore.h
//
// Library: Net
// Package: Messages
// Module: PartStore
//
// Definition of the PartStore class.
//
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Net_PartStore_INCLUDED
#define Net_PartStore_INCLUDED
#include "Poco/Net/Net.h"
#include "Poco/Net/PartSource.h"
#include "Poco/FileStream.h"
namespace Poco {
namespace Net {
class Net_API PartStore: public PartSource
/// A parent class for part stores storing message parts.
{
public:
PartStore(const std::string& mediaType);
/// Creates the PartStore for the given MIME type.
~PartStore();
/// Destroys the PartFileStore.
private:
PartStore();
};
class Net_API FilePartStore: public PartStore
/// An implementation of PartSource for persisting
/// parts (usually email attachment files) to the file system.
{
public:
FilePartStore(const std::string& content, const std::string& mediaType, const std::string& filename = "");
/// Creates the FilePartStore for the given MIME type.
/// For security purposes, attachment filename is NOT used to save file to the file system.
/// A unique temporary file name is used to persist the file.
/// The given filename parameter is the message part (attachment) filename (see filename()) only.
///
/// Throws an exception if the file cannot be opened.
~FilePartStore();
/// Destroys the FilePartStore.
std::istream& stream();
/// Returns a file input stream for the given file.
const std::string& filename() const;
/// Returns the filename portion of the path.
/// This is the name under which the file is known
/// to the user of this class (typically, MailMessage
/// class). The real name of the file as saved
/// to the filesystem can be obtained by calling
/// path() member function.
const std::string& path() const;
/// Returns the full path to the file as saved
/// to the file system. For security reasons,
/// file is not saved under the real file name
/// (as specified by the user).
private:
std::string _filename;
std::string _path;
Poco::FileStream _fstr;
};
class PartStoreFactory
/// Parent factory class for part stores creation.
{
public:
virtual PartSource* createPartStore(const std::string& content, const std::string& mediaType, const std::string& filename = "") = 0;
};
class FilePartStoreFactory: public PartStoreFactory
{
public:
PartSource* createPartStore(const std::string& content, const std::string& mediaType, const std::string& filename = "")
{
return new FilePartStore(content, mediaType, filename);
}
};
} } // namespace Poco::Net
#endif // Net_PartStore_INCLUDED
|