Free Electron
DevRecordView.h
Go to the documentation of this file.
1 /** @file */
2 
3 #pragma once
4 
5 namespace fe
6 {
7 namespace ext
8 {
9 
10 /**
11  * Development version of a Record View.
12  *
13  * Not finalized, work in proggress.
14  */
16  public AccessorSet
17  // virtual public RecordFactoryI
18 {
19 public:
20  DevRecordView() {};
21 
22  /** Create a Record using all the attributes.
23  *
24  * The Record is automatically bound.
25  */
27  {
28  if(!m_hpScope.isValid())
29  {
30  feX("RecordView::createRecord",
31  "\"%s\" has invalid scope\n",
32  name().c_str());
33  }
34 
35  Record newrecord = m_hpScope->createRecord(getLayout());
36  if(!layout.isValid())
37  {
38  feX("RecordView::createRecord",
39  "\"%s\" failed to create layout\n",
40  name().c_str());
41  }
42  if(!newrecord.isValid())
43  {
44  feX("RecordView::createRecord",
45  "\"%s\" failed to create record\n",
46  name().c_str());
47  }
48 
49  record = newrecord;
50 
51  bind(record);
52  // initializeRecord();
53  return newrecord;
54  };
55 
56  WeakRecord getRecord() const
57  {
58  return record;
59  };
60 
61  /**
62  * Access a Layout of all the attributes.
63  */
65  {
66  if(!m_hpScope.isValid())
67  {
68  feLog("RecordView::layout \"%s\" invalid scope\n",
69  name().c_str());
70  return sp<Layout>(NULL);
71  }
72 
73  if(!layout.isValid())
74  {
75  layout = createLayout();
76  }
77 
78  return layout;
79  };
80 
81 protected:
82 
83 private:
84  DevRecordView(const DevRecordView& rRecordView): AccessorSet() {};
85 
86  sp<Layout> createLayout()
87  {
88  if(!m_hpScope.isValid())
89  {
90  feX("AccessorArray::createLayout",
91  "\"%s\" has invalid scope\n",
92  name().c_str());
93  }
94 
95  sp<Layout> spLayout = m_hpScope->declare(name());
96  if(!spLayout.isValid())
97  {
98  feX("AccessorArray::createLayout",
99  "\"%s\" failed to create layout\n",
100  name().c_str());
101  }
102 
103  populate(spLayout);
104  return spLayout;
105  }
106 
107  hp<Layout> layout;
108  WeakRecord record;
109 };
110 
111 inline BWORD operator==(const DevRecordView& rRecordView1,
112  const DevRecordView& rRecordView2)
113 {
114  return rRecordView1.getRecord()==rRecordView2.getRecord();
115 }
116 
117 inline BWORD operator!=(const DevRecordView& rRecordView1,
118  const DevRecordView& rRecordView2)
119 {
120  return rRecordView1.getRecord()!=rRecordView2.getRecord();
121 }
122 
123 } /* namespace ext */
124 } /* namespace fe */
Set of accessors.
Definition: AccessorSet.h:18
bool isValid(void) const
Return true if the Record points to a valid state block.
Definition: RecordSB.h:184
kernel
Definition: namespace.dox:3
BWORD operator!=(const DualString &s1, const DualString &s2)
Compare two DualString&#39;s (reverse logic)
Definition: DualString.h:229
Record createRecord()
Create a Record using all the attributes.
Definition: DevRecordView.h:26
sp< Layout > getLayout()
Access a Layout of all the attributes.
Definition: DevRecordView.h:64
Reference to an instance of a Layout.
Definition: RecordSB.h:35
Development version of a Record View.
Definition: DevRecordView.h:15
const String & name(void) const
Return the components chosen name.
Definition: Component.h:77
BWORD isValid(void) const
Returns true if the pointer is set.
Definition: Handled.h:179
Non-persistent reference to an instance of a Layout.
Definition: WeakRecordSB.h:17