CFilteredOptionsListComp.h
Go to the documentation of this file.
1 #ifndef iprm_CFilteredOptionsListComp_included
2 #define iprm_CFilteredOptionsListComp_included
3 
4 
5 // ACF includes
6 #include <iser/ISerializable.h>
7 #include <icomp/CComponentBase.h>
8 #include <iprm/IOptionsList.h>
9 
10 
11 namespace iprm
12 {
13 
14 
19  public icomp::CComponentBase,
20  virtual public iprm::IOptionsList
21 {
22 public:
24 
25  I_BEGIN_COMPONENT(CFilteredOptionsListComp);
26  I_REGISTER_INTERFACE(istd::IChangeable);
27  I_REGISTER_INTERFACE(iprm::IOptionsList);
28  I_ASSIGN_MULTI_0(m_includeIdsAttrPtr, "IncludeOptionIds", "List of included (passed by filter) option IDs", true);
29  I_ASSIGN(m_inputOptionsCompPtr, "InputOptionsList", "List of options to be filtered", true, "InputOptionsList");
30  I_END_COMPONENT;
31 
32  // reimplemented (iprm::IOptionsList)
33  virtual int GetOptionsFlags() const;
34  virtual int GetOptionsCount() const;
35  virtual QString GetOptionName(int index) const;
36  virtual QString GetOptionDescription(int index) const;
37  virtual QByteArray GetOptionId(int index) const;
38  virtual bool IsOptionEnabled(int index) const;
39 
40 protected:
41  // reimplemented (icomp::CComponentBase)
42  virtual void OnComponentCreated();
43 
44 private:
45  void UpdateOptions();
46 
47  static int GetOptionById(const iprm::IOptionsList& options, const QByteArray& optionId);
48 
49 private:
50  I_MULTIATTR(QByteArray, m_includeIdsAttrPtr);
51 
52  I_REF(iprm::IOptionsList, m_inputOptionsCompPtr);
53 
54  struct Option
55  {
56  QString description;
57  QString name;
58  QByteArray id;
59  bool isEnabled;
60  };
61 
62  typedef QVector<Option> Options;
63 
64  Options m_options;
65 };
66 
67 
68 } // namespace iprm
69 
70 
71 #endif // !iprm_CFilteredOptionsListComp_included
72 
73 
virtual int GetOptionsFlags() const
Get constraints flags.
Base class for component implementation.
Constraints of selection from set of possibilities.
Definition: IOptionsList.h:22
virtual QByteArray GetOptionId(int index) const
Get option ID.
Implementation of an option list filter.
virtual int GetOptionsCount() const
Get number of managed options.
Common interface for data model objects, which can be changed.
Definition: IChangeable.h:24
virtual bool IsOptionEnabled(int index) const
Return true if the option is enabled and can be selected.
virtual QString GetOptionName(int index) const
Get name of specified option.
virtual QString GetOptionDescription(int index) const
Get human readable description for a option with the index index.

© 2007-2017 Witold Gantzke and Kirill Lepskiy