CComposedFilePersistenceComp.h
Go to the documentation of this file.
1 #ifndef ifile_CComposedFilePersistenceComp_included
2 #define ifile_CComposedFilePersistenceComp_included
3 
4 
5 // ACF includes
8 #include <icomp/CComponentBase.h>
9 
10 // Qt includes
11 #include <QtCore/QFileInfo>
12 
13 
14 namespace ifile
15 {
16 
17 
24  public icomp::CComponentBase,
25  virtual public ifile::IFilePersistence,
26  virtual public ifile::IFilePersistenceInfo
27 {
28 public:
30 
31  I_BEGIN_COMPONENT(CComposedFilePersistenceComp);
32  I_REGISTER_INTERFACE(ifile::IFileTypeInfo);
33  I_REGISTER_INTERFACE(ifile::IFilePersistence);
34  I_REGISTER_INTERFACE(ifile::IFilePersistenceInfo);
35  I_ASSIGN_MULTI_0(m_slaveLoadersCompPtr, "SlaveLoaders", "List of slave loaders", true);
36  I_ASSIGN(m_commonDescriptionAttrPtr, "CommonDescription", "Optional common description of this file type", false, "Composed");
37  I_END_COMPONENT;
38 
39  // reimplemented (ifile::IFilePersistence)
40  virtual bool IsOperationSupported(
41  const istd::IChangeable* dataObjectPtr,
42  const QString* filePathPtr = NULL,
43  int flags = -1,
44  bool beQuiet = true) const;
45  virtual int LoadFromFile(
46  istd::IChangeable& data,
47  const QString& filePath = QString(),
48  ibase::IProgressManager* progressManagerPtr = NULL) const;
49  virtual int SaveToFile(
50  const istd::IChangeable& data,
51  const QString& filePath = QString(),
52  ibase::IProgressManager* progressManagerPtr = NULL) const;
53 
54  // reimplemented (ifile::IFileTypeInfo)
55  virtual bool GetFileExtensions(QStringList& result, const istd::IChangeable* dataObjectPtr = NULL, int flags = -1, bool doAppend = false) const;
56  virtual QString GetTypeDescription(const QString* extensionPtr = NULL) const;
57 
58  // reimplemented (ifile::IFilePersistenceInfo)
59  virtual QString GetLastFilePath(OperationType operationType = OT_UNKNOWN, PathType pathType = PT_COMPLETE) const;
60 
61 protected:
62  QString GetPathForType(const QFileInfo& fileInfo, PathType pathType) const;
63 
64 private:
65  I_MULTIREF(ifile::IFilePersistence, m_slaveLoadersCompPtr);
66  I_TEXTATTR(m_commonDescriptionAttrPtr);
67 
68  mutable QFileInfo m_lastOpenInfo;
69  mutable QFileInfo m_lastSaveInfo;
70 };
71 
72 
73 } // namespace ifile
74 
75 
76 #endif // !ifile_CComposedFilePersistenceComp_included
77 
78 
virtual int LoadFromFile(istd::IChangeable &data, const QString &filePath=QString(), ibase::IProgressManager *progressManagerPtr=NULL) const
This function loads data data from file filePath.
Provide loading and saving of objects.
Definition: IFileTypeInfo.h:22
virtual int SaveToFile(const istd::IChangeable &data, const QString &filePath=QString(), ibase::IProgressManager *progressManagerPtr=NULL) const
This function saves data data to file filePath.
virtual bool IsOperationSupported(const istd::IChangeable *dataObjectPtr, const QString *filePathPtr=NULL, int flags=-1, bool beQuiet=true) const
Returns true if object dataObject can be loaded/saved.
Base class for component implementation.
Loader component, which delegates the persistence functionality to its slave loaders.
Common interface for data model objects, which can be changed.
Definition: IChangeable.h:24
Provide some information about file loader state.
#define NULL
Definition: istd.h:64
Interface providing loading and saving of data objects.
QString GetPathForType(const QFileInfo &fileInfo, PathType pathType) const
virtual QString GetLastFilePath(OperationType operationType=OT_UNKNOWN, PathType pathType=PT_COMPLETE) const
Returns the last opened file name.
virtual QString GetTypeDescription(const QString *extensionPtr=NULL) const
Get description of object type associated with single extension.
Consume information about progress of some process.
virtual bool GetFileExtensions(QStringList &result, const istd::IChangeable *dataObjectPtr=NULL, int flags=-1, bool doAppend=false) const
Get file extensions supported by this loader.

© 2007-2017 Witold Gantzke and Kirill Lepskiy