CRightsBasedEnablerComp.h
Go to the documentation of this file.
1 #ifndef iauth_CRightsBasedEnablerComp_included
2 #define iauth_CRightsBasedEnablerComp_included
3 
4 
5 // Qt includes
6 #include <QtCore/QByteArray>
7 
8 // ACF includes
9 #include "icomp/CComponentBase.h"
11 #include "iprm/IEnableableParam.h"
12 
13 // ACF-Solutions includes
14 #include "iauth/IRightsProvider.h"
15 
16 
17 namespace iauth
18 {
19 
20 
25  public icomp::CComponentBase,
26  virtual public iprm::IEnableableParam,
27  protected imod::TSingleModelObserverBase<iauth::IRightsProvider>
28 {
29 public:
32 
33  I_BEGIN_COMPONENT(CRightsBasedEnablerComp);
34  I_REGISTER_INTERFACE(iprm::IEnableableParam);
35  I_ASSIGN(m_rightsProviderCompPtr, "RightsProvider", "Slave rights provider", true, "RightsProvider");
36  I_ASSIGN_TO(m_rightsProviderModelCompPtr, m_rightsProviderCompPtr, true);
37  I_ASSIGN_MULTI_0(m_rightIdsAttrPtr, "RightIds", "List of right IDs to be checked for calculation of the entire enabling state", true);
38  I_END_COMPONENT;
39 
41 
42  // reimplemented (iprm::IEnableableParam)
43  virtual bool IsEnabled() const;
44  virtual bool IsEnablingAllowed() const;
45  virtual bool SetEnabled(bool isEnabled = true);
46 
47  // reimplemented (iser::ISerializable)
48  virtual bool Serialize(iser::IArchive& archive);
49 
50 protected:
51  // reimplemented (icomp::CComponentBase)
52  virtual void OnComponentCreated();
53  virtual void OnComponentDestroyed();
54 
55  // reimplemented (imod::TSingleModelObserverBase)
56  virtual void OnUpdate(int updateFlags, istd::IPolymorphic* updateParamsPtr);
57 
58 private:
62  I_REF(IRightsProvider, m_rightsProviderCompPtr);
63  I_REF(imod::IModel, m_rightsProviderModelCompPtr);
64 
68  I_MULTIATTR(QByteArray, m_rightIdsAttrPtr);
69 
73  bool m_isEnabled;
74 };
75 
76 
77 } // namespace iauth
78 
79 
80 #endif // !iauth_CRightsBasedEnablerComp_included
81 
82 
I_ASSIGN_TO(m_rightsProviderModelCompPtr, m_rightsProviderCompPtr, true)
imod::TSingleModelObserverBase< iauth::IRightsProvider > BaseClass2
State component implementation based on underlaying rights provider.
virtual bool IsEnabled() const
virtual void OnComponentDestroyed()
virtual bool IsEnablingAllowed() const
virtual void OnUpdate(int updateFlags, istd::IPolymorphic *updateParamsPtr)
virtual bool SetEnabled(bool isEnabled=true)
virtual bool Serialize(iser::IArchive &archive)

© 2007-2011 Witold Gantzke and Kirill Lepskiy