CTextFileLoaderComp.h
Go to the documentation of this file.
1 #ifndef idoc_CTextFileLoaderComp_included
2 #define idoc_CTextFileLoaderComp_included
3 
4 
5 // ACF includes
7 #include <icomp/CComponentBase.h>
8 
9 
10 namespace idoc
11 {
12 
13 
18 {
19 public:
21 
22  I_BEGIN_COMPONENT(CTextFileLoaderComp);
23  I_REGISTER_INTERFACE(ifile::IFileTypeInfo);
24  I_REGISTER_INTERFACE(ifile::IFilePersistence);
25  I_ASSIGN_MULTI_1(m_fileExtensionsAttrPtr, "FileExtensions", "List of possible file extensions", true, "txt");
26  I_ASSIGN_MULTI_1(m_typeDescriptionsAttrPtr, "TypeDescriptions", "List of descriptions for each extension", true, "Text file");
27  I_END_COMPONENT;
28 
29  // reimplemented (ifile::IFilePersistence)
30  virtual bool IsOperationSupported(
31  const istd::IChangeable* dataObjectPtr,
32  const QString* filePathPtr = NULL,
33  int flags = -1,
34  bool beQuiet = true) const;
35  virtual int LoadFromFile(
36  istd::IChangeable& data,
37  const QString& filePath = QString(),
38  ibase::IProgressManager* progressManagerPtr = NULL) const;
39  virtual int SaveToFile(
40  const istd::IChangeable& data,
41  const QString& filePath = QString(),
42  ibase::IProgressManager* progressManagerPtr = NULL) const;
43 
44  // reimplemented (ifile::IFileTypeInfo)
45  virtual bool GetFileExtensions(QStringList& result, const istd::IChangeable* dataObjectPtr = NULL, int flags = -1, bool doAppend = false) const;
46  virtual QString GetTypeDescription(const QString* extensionPtr = NULL) const;
47 
48 private:
49  I_MULTIATTR(QString, m_fileExtensionsAttrPtr);
50  I_MULTITEXTATTR(m_typeDescriptionsAttrPtr);
51 };
52 
53 
54 } // namespace idoc
55 
56 
57 #endif // !idoc_CTextFileLoaderComp_included
58 
59 
icomp::CComponentBase BaseClass
virtual QString GetTypeDescription(const QString *extensionPtr=NULL) const
Get description of object type associated with single extension.
Provide loading and saving of objects.
Definition: IFileTypeInfo.h:22
virtual int LoadFromFile(istd::IChangeable &data, const QString &filePath=QString(), ibase::IProgressManager *progressManagerPtr=NULL) const
This function loads data data from file filePath.
Base class for component implementation.
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.
virtual int SaveToFile(const istd::IChangeable &data, const QString &filePath=QString(), ibase::IProgressManager *progressManagerPtr=NULL) const
This function saves data data to file filePath.
Common interface for data model objects, which can be changed.
Definition: IChangeable.h:24
#define NULL
Definition: istd.h:64
Interface providing loading and saving of data objects.
virtual bool GetFileExtensions(QStringList &result, const istd::IChangeable *dataObjectPtr=NULL, int flags=-1, bool doAppend=false) const
Get file extensions supported by this loader.
Persistence component for the files contains plain text.
Consume information about progress of some process.

© 2007-2017 Witold Gantzke and Kirill Lepskiy