ACF $AcfVersion:0$
CFileSerializerCompBase.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// Qt includes
6#include <QtCore/QObject>
7#include <QtCore/QStringList>
8#include <QtCore/QFileInfo>
9
10// ACF includes
14
15
16namespace ifile
17{
18
19
27 public ilog::TLoggerCompWrap<CFileTypeInfoComp>,
28 virtual public ifile::IFilePersistence
29{
30public:
32
33 I_BEGIN_BASE_COMPONENT(CFileSerializerCompBase);
34 I_REGISTER_INTERFACE(ifile::IFileTypeInfo);
35 I_REGISTER_INTERFACE(ifile::IFilePersistence);
36 I_ASSIGN(m_beQuiteOnLoadAttrPtr, "BeQuiteOnLoad", "Do not log message when loading if file is missing", true, false);
37 I_ASSIGN(m_versionInfoCompPtr, "VersionInfo", "Provide information about archive versions", false, "VersionInfo");
38 I_END_COMPONENT;
39
40 // reimplemented (ifile::IFilePersistence)
42 const istd::IChangeable* dataObjectPtr,
43 const QString* filePathPtr = nullptr,
44 int flags = -1,
45 bool beQuiet = true) const override;
46protected:
50 virtual const iser::IVersionInfo* GetVersionInfo() const;
51
55 bool CheckMinimalVersion(const iser::ISerializable& object, const iser::IVersionInfo& versionInfo) const;
56
60 bool CheckInputFile(const QString filePath, bool beQuiet = true) const;
61
65 bool CheckOutputFile(const QString filePath, bool beQuiet = true) const;
66
67 // reimplemented (icomp::CComponentBase)
68 virtual void OnComponentCreated() override;
69
70protected:
71 I_ATTR(bool, m_beQuiteOnLoadAttrPtr);
72
73private:
74 I_REF(iser::IVersionInfo, m_versionInfoCompPtr);
75};
76
77
78} // namespace ifile
79
80
Base implementation of file serializer.
virtual 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.
virtual void OnComponentCreated() override
Called when component is created.
bool CheckOutputFile(const QString filePath, bool beQuiet=true) const
Check if output file is OK.
virtual const iser::IVersionInfo * GetVersionInfo() const
Get working version info.
bool CheckMinimalVersion(const iser::ISerializable &object, const iser::IVersionInfo &versionInfo) const
Check if the minimal version of some serializable object is supported by version info.
bool CheckInputFile(const QString filePath, bool beQuiet=true) const
Check if input file is OK.
ilog::TLoggerCompWrap< CFileTypeInfoComp > BaseClass
Interface providing loading and saving of data objects.
Provide loading and saving of objects.
Template wrapper adding comprehensive logging functionality to components.
Common class for all classes which objects can be archived or restored from archive.
Provides access to version information.
Common interface for data model objects, which can be changed.
Definition IChangeable.h:28
Contains interfaces and implementations of file system related components.