ICF 3.1.1.10
Technical documentation of ICF Libraries
CComposedFilePersistenceComp.h
Go to the documentation of this file.
1/********************************************************************************
2** This file is part of the ICF Framework. Copyright (C) Witold Gantzke & Kirill Lepskiy
3** ICF Framework may be used under the terms of the LGPL License v. 2.1 by the Free Software Foundation.
4********************************************************************************/
5
6#pragma once
7
8
9// ICF includes
13
14// Qt includes
15#include <QtCore/QFileInfo>
16
17
18namespace ifile
19{
20
21
27 virtual public ifile::IFilePersistence,
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::IFilePersistenceInfo);
37 I_ASSIGN_MULTI_0(m_slaveLoadersCompPtr, "SlaveLoaders", "List of slave loaders", true);
38 I_ASSIGN(m_commonDescriptionAttrPtr, "CommonDescription", "Optional common description of this file type", false, "Composed");
39 I_END_COMPONENT;
40
41 // reimplemented (ifile::IFilePersistence)
43 const istd::IChangeable* dataObjectPtr,
44 const QString* filePathPtr = nullptr,
45 int flags = -1,
46 bool beQuiet = true) const override;
49 const QString& filePath = QString(),
50 iproc::IProgressManager* progressManagerPtr = nullptr) const override;
52 const istd::IChangeable& data,
53 const QString& filePath = QString(),
54 iproc::IProgressManager* progressManagerPtr = nullptr) const override;
55
56 // reimplemented (ifile::IFileTypeInfo)
57 bool GetFileExtensions(QStringList& result, const istd::IChangeable* dataObjectPtr = nullptr, int flags = -1, bool doAppend = false) const override;
58 QString GetTypeDescription(const QString* extensionPtr = nullptr) const override;
59
60 // reimplemented (ifile::IFilePersistenceInfo)
61 QString GetLastFilePath(OperationType operationType = OT_UNKNOWN, PathType pathType = PT_COMPLETE) const override;
62
63protected:
64 QString GetPathForType(const QFileInfo& fileInfo, PathType pathType) const;
65
66private:
67 I_MULTIREF(ifile::IFilePersistence, m_slaveLoadersCompPtr);
68 I_TEXTATTR(m_commonDescriptionAttrPtr);
69
70 mutable QFileInfo m_lastOpenInfo;
71 mutable QFileInfo m_lastSaveInfo;
72};
73
74
75} // namespace ifile
76
77
Base class for component implementation.
Loader component, which delegates the persistence functionality to its slave loaders.
QString GetTypeDescription(const QString *extensionPtr=nullptr) const override
Get description of object type associated with single extension.
iproc::CTaskState SaveToFile(const istd::IChangeable &data, const QString &filePath=QString(), iproc::IProgressManager *progressManagerPtr=nullptr) const override
This function saves data data to file filePath.
bool IsOperationSupported(const istd::IChangeable *dataObjectPtr, const QString *filePathPtr=nullptr, int flags=-1, bool beQuiet=true) const override
Returns true if object dataObject can be loaded/saved.
bool GetFileExtensions(QStringList &result, const istd::IChangeable *dataObjectPtr=nullptr, int flags=-1, bool doAppend=false) const override
Get file extensions supported by this loader.
QString GetPathForType(const QFileInfo &fileInfo, PathType pathType) const
QString GetLastFilePath(OperationType operationType=OT_UNKNOWN, PathType pathType=PT_COMPLETE) const override
Returns the last opened file name.
iproc::CTaskState LoadFromFile(istd::IChangeable &data, const QString &filePath=QString(), iproc::IProgressManager *progressManagerPtr=nullptr) const override
This function loads data data from file filePath.
Interface providing loading and saving of data objects.
Provide some information about file loader state.
Provide loading and saving of objects.
Represent state of asynchronous operation.
Definition CTaskState.h:28
Consume information about progress of some process.
Common interface for data model objects, which can be changed.
Definition IChangeable.h:32
Contains interfaces and implementations of file system related components.

© Witold Gantzke and Kirill Lepskiy