CRenderedObjectFileLoaderComp.h
Go to the documentation of this file.
1 #ifndef ifileproc_CRenderedObjectFileLoaderComp_included
2 #define ifileproc_CRenderedObjectFileLoaderComp_included
3 
4 
5 // Qt includes
6 #include <QtCore/QDateTime>
7 
8 // ACF includes
9 #include "istd/TSmartPtr.h"
10 #include "iser/ISerializable.h"
11 #include "icomp/CComponentBase.h"
12 #include "ibase/IObjectSnap.h"
13 #include "ifile/IFilePersistence.h"
14 #include "iimg/CBitmap.h"
15 
16 
17 namespace ifileproc
18 {
19 
20 
22  public icomp::CComponentBase,
23  virtual public ifile::IFilePersistence,
24  virtual public iser::ISerializable
25 {
26 public:
28 
29  I_BEGIN_COMPONENT(CRenderedObjectFileLoaderComp);
30  I_REGISTER_INTERFACE(istd::IChangeable);
31  I_REGISTER_INTERFACE(ifile::IFilePersistence);
32  I_REGISTER_INTERFACE(iser::ISerializable);
33  I_ASSIGN(m_fileLoaderCompPtr, "FileLoader", "File loader, which will used to open the input file", true, "FileLoader");
34  I_ASSIGN(m_fileDataCompPtr, "FileData", "Data component for the loader", true, "FileData");
35  I_ASSIGN(m_objectSnapCompPtr, "ObjectSnap", "Component for bitmap snap of a concrete object", true, "ObjectSnap");
36  I_ASSIGN(m_widthAttrPtr, "BitmapWidth", "Width of the generated preview bitmap", true, 128);
37  I_ASSIGN(m_heightAttrPtr, "BitmapHeight", "Height of the generated preview bitmap", true, 128);
38  I_ASSIGN(m_maxCacheSizeAttrPtr, "MaxCacheSize", "Maximal number of bitmaps in cache", false, 100);
39  I_END_COMPONENT;
40 
41  // reimplemented (ifile::IFilePersistence)
42  virtual bool IsOperationSupported(
43  const istd::IChangeable* dataObjectPtr,
44  const QString* filePathPtr = NULL,
45  int flags = -1,
46  bool beQuiet = true) const;
47  virtual int LoadFromFile(istd::IChangeable& data, const QString& filePath = QString()) const;
48  virtual int SaveToFile(const istd::IChangeable& data, const QString& filePath = QString()) const;
49 
50  // reimplemented (ifile::IFileTypeInfo)
51  virtual bool GetFileExtensions(QStringList& result, int flags = -1, bool doAppend = false) const;
52  virtual QString GetTypeDescription(const QString* extensionPtr = NULL) const;
53 
54  // reimplemented (iser::ISerializable)
55  virtual bool Serialize(iser::IArchive& archive);
56 
57 private:
58  I_REF(ifile::IFilePersistence, m_fileLoaderCompPtr);
59  I_REF(istd::IChangeable, m_fileDataCompPtr);
60  I_REF(ibase::IObjectSnap, m_objectSnapCompPtr);
61  I_ATTR(int, m_widthAttrPtr);
62  I_ATTR(int, m_heightAttrPtr);
63  I_ATTR(int, m_maxCacheSizeAttrPtr);
64 
65  struct FileInfo
66  {
67  QDateTime fileTimeStamp;
68  istd::TSmartPtr<iimg::CBitmap> fileBitmapPtr;
69  };
70 
71  typedef QMap<QString, FileInfo> PreviewCache;
72 
73  mutable PreviewCache m_previewCache;
74 };
75 
76 
77 } // namespace ifileproc
78 
79 
80 #endif // !ifileproc_CRenderedObjectFileLoaderComp_included
81 
82 
virtual bool GetFileExtensions(QStringList &result, int flags=-1, bool doAppend=false) const
virtual bool IsOperationSupported(const istd::IChangeable *dataObjectPtr, const QString *filePathPtr=NULL, int flags=-1, bool beQuiet=true) const
virtual int LoadFromFile(istd::IChangeable &data, const QString &filePath=QString()) const
virtual bool Serialize(iser::IArchive &archive)
virtual QString GetTypeDescription(const QString *extensionPtr=NULL) const
virtual int SaveToFile(const istd::IChangeable &data, const QString &filePath=QString()) const

© 2007-2011 Witold Gantzke and Kirill Lepskiy