TComponentRegistrator.h
Go to the documentation of this file.
1 #ifndef icomp_TComponentRegistrator_included
2 #define icomp_TComponentRegistrator_included
3 
4 
5 // Qt includes
6 #include <QtCore/QByteArray>
7 
8 // ACF includes
11 
12 
13 namespace icomp
14 {
15 
16 
20 template <class Component>
22 {
23 public:
25 
27  const QByteArray& componentId,
28  icomp::CPackageStaticInfo& packageStaticInfo,
29  const QString& description,
30  const QString& keywords);
31 
32  // reimplemented (icomp::IComponentStaticInfo)
33  virtual const QString& GetDescription() const;
34  virtual const QString& GetKeywords() const;
35 
36 private:
37  QByteArray m_logicalName;
38  QString m_description;
39  QString m_keywords;
40 };
41 
42 
43 // public methods
44 
45 template <class Component>
47  const QByteArray& componentId,
48  icomp::CPackageStaticInfo& packageStaticInfo,
49  const QString& description,
50  const QString& keywords)
51 : BaseClass(&Component::InitStaticInfo(NULL)),
52  m_description(description),
53  m_keywords(keywords)
54 {
55  packageStaticInfo.RegisterEmbeddedComponentInfo(componentId, this);
56 
57  m_keywords += " ";
58 
59  m_keywords += packageStaticInfo.GetKeywords();
60 }
61 
62 
63 // reimplemented (icomp::IComponentStaticInfo)
64 
65 template <class Component>
67 {
68  return m_description;
69 }
70 
71 
72 template <class Component>
74 {
75  return m_keywords;
76 }
77 
78 
79 } // namespace icomp
80 
81 
82 #endif // !icomp_TComponentRegistrator_included
83 
84 
virtual const QString & GetKeywords() const
Get keywords for this component.
TComponentRegistrator(const QByteArray &componentId, icomp::CPackageStaticInfo &packageStaticInfo, const QString &description, const QString &keywords)
Static info for component package.
virtual const QString & GetDescription() const
Get human readable description of this component.
virtual const QString & GetKeywords() const
Get keywords for this component.
#define NULL
Definition: istd.h:64
Simple helper class providing registration of template-specified component in package.
icomp::TComponentStaticInfo< Component > BaseClass
virtual void RegisterEmbeddedComponentInfo(const QByteArray &embeddedId, const IComponentStaticInfo *componentInfoPtr)
Register embedded component static info.

© 2007-2017 Witold Gantzke and Kirill Lepskiy