ACF $AcfVersion:0$
CComposedFilePersistenceComp.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-2.1-or-later OR GPL-2.0-or-later OR GPL-3.0-or-later OR LicenseRef-ACF-Commercial
2#pragma once
3
4
5// ACF includes
10
11// Qt includes
12#include <QtCore/QFileInfo>
13
14
15namespace ifile
16{
17
18
26 virtual public ifile::IFilePersistence,
27 virtual public ifile::IDeviceBasedPersistence,
28 virtual public ifile::IFilePersistenceInfo
29{
30public:
32
33 I_BEGIN_COMPONENT(CComposedFilePersistenceComp);
34 I_REGISTER_INTERFACE(ifile::IFileTypeInfo);
35 I_REGISTER_INTERFACE(ifile::IFilePersistence);
36 I_REGISTER_INTERFACE(ifile::IDeviceBasedPersistence);
37 I_REGISTER_INTERFACE(ifile::IFilePersistenceInfo);
38 I_ASSIGN_MULTI_0(m_slaveLoadersCompPtr, "SlaveLoaders", "List of slave loaders", true);
39 I_ASSIGN(m_commonDescriptionAttrPtr, "CommonDescription", "Optional common description of this file type", false, "Composed");
40 I_END_COMPONENT;
41
42 // reimplemented (ifile::IFilePersistence)
44 const istd::IChangeable* dataObjectPtr,
45 const QString* filePathPtr = NULL,
46 int flags = -1,
47 bool beQuiet = true) const override;
50 const QString& filePath = QString(),
51 ibase::IProgressManager* progressManagerPtr = NULL) const override;
53 const istd::IChangeable& data,
54 const QString& filePath = QString(),
55 ibase::IProgressManager* progressManagerPtr = NULL) const override;
56
57 // reimplemented (ifile::IDeviceBasedPersistence)
59 const istd::IChangeable& dataObject,
60 const QIODevice& device,
61 int deviceOperation) const override;
64 QIODevice& device,
65 ibase::IProgressManager* progressManagerPtr = nullptr) const override;
67 const istd::IChangeable& data,
68 QIODevice& device,
69 ibase::IProgressManager* progressManagerPtr = nullptr) const override;
70
71 // reimplemented (ifile::IFileTypeInfo)
72 virtual bool GetFileExtensions(QStringList& result, const istd::IChangeable* dataObjectPtr = NULL, int flags = -1, bool doAppend = false) const override;
73 virtual QString GetTypeDescription(const QString* extensionPtr = NULL) const override;
74
75 // reimplemented (ifile::IFilePersistenceInfo)
76 virtual QString GetLastFilePath(OperationType operationType = OT_UNKNOWN, PathType pathType = PT_COMPLETE) const override;
77
78protected:
79 QString GetPathForType(const QFileInfo& fileInfo, PathType pathType) const;
80
81private:
82 I_MULTIREF(ifile::IFilePersistence, m_slaveLoadersCompPtr);
83 I_TEXTATTR(m_commonDescriptionAttrPtr);
84
85 mutable QFileInfo m_lastOpenInfo;
86 mutable QFileInfo m_lastSaveInfo;
87};
88
89
90} // namespace ifile
91
92
Consume information about progress of some process.
Base class for component implementation.
Loader component, which delegates the persistence functionality to its slave loaders.
virtual bool IsOperationSupported(const istd::IChangeable *dataObjectPtr, const QString *filePathPtr=NULL, int flags=-1, bool beQuiet=true) const override
Returns true if object dataObject can be loaded/saved.
virtual bool GetFileExtensions(QStringList &result, const istd::IChangeable *dataObjectPtr=NULL, int flags=-1, bool doAppend=false) const override
Get file extensions supported by this loader.
virtual ifile::IFilePersistence::OperationState SaveToFile(const istd::IChangeable &data, const QString &filePath=QString(), ibase::IProgressManager *progressManagerPtr=NULL) const override
This function saves data data to file filePath.
virtual QString GetTypeDescription(const QString *extensionPtr=NULL) const override
Get description of object type associated with single extension.
virtual QString GetLastFilePath(OperationType operationType=OT_UNKNOWN, PathType pathType=PT_COMPLETE) const override
Returns the last opened file name.
QString GetPathForType(const QFileInfo &fileInfo, PathType pathType) const
virtual ifile::IDeviceBasedPersistence::OperationState ReadFromDevice(istd::IChangeable &data, QIODevice &device, ibase::IProgressManager *progressManagerPtr=nullptr) const override
This function loads data data from the given I/O-device device.
virtual bool IsDeviceOperationSupported(const istd::IChangeable &dataObject, const QIODevice &device, int deviceOperation) const override
Returns true if object dataObject can be processed via defined I/O-device.
virtual ifile::IFilePersistence::OperationState LoadFromFile(istd::IChangeable &data, const QString &filePath=QString(), ibase::IProgressManager *progressManagerPtr=NULL) const override
This function loads data data from file filePath.
virtual ifile::IDeviceBasedPersistence::OperationState WriteToDevice(const istd::IChangeable &data, QIODevice &device, ibase::IProgressManager *progressManagerPtr=nullptr) const override
This function writes data data to the given I/O-device device.
Interface providing reading and writing data objects via I/O-devices.
OperationState
Result of device-related operation.
Interface providing loading and saving of data objects.
OperationState
Result of operation.
Provide some information about file loader state.
Provide loading and saving of objects.
Common interface for data model objects, which can be changed.
Definition IChangeable.h:28
#define I_TEXTATTR(member)
Declare translatable text attribute member.
#define NULL
Definition istd.h:74
Contains interfaces and implementations of file system related components.