VisualIB
1.0
IBExpress library for making use of Borland IBExpress outside of C++Builder
Main Page
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
VIBProperties.h
Go to the documentation of this file.
1
7
#ifndef VIBPROPERTIES_H__
8
#define VIBPROPERTIES_H__
9
10
#include <functional>
11
12
namespace
VIB
13
{
24
template
<
typename
T>
class
Property
25
{
26
protected
:
27
typedef
std::function<T (void)>
Getter
;
28
typedef
std::function<void (const T &)>
Setter
;
29
30
Getter
get
;
31
Setter
set
;
32
33
public
:
37
Property
() :
get
(),
set
() {}
38
46
Property
(
const
Getter
&pGet,
const
Setter
&pSet) :
get
(pGet),
set
(pSet)
47
{
48
}
49
57
void
initCallbacks
(
const
Getter
&pGet,
const
Setter
&pSet)
58
{
59
get
= pGet;
60
set
= pSet;
61
}
62
68
operator
T() {
return
get
(); }
69
77
Property<T>
&
operator =
(
const
T &nv) {
set
(nv);
return
*
this
; }
78
86
T
operator ->
() {
return
get
(); }
87
};
88
96
template
<
typename
T,
typename
A>
class
ArrayProperty
:
public
Property
<T>
97
{
98
public
:
102
ArrayProperty<T, A>
() :
Property<T>
() {}
103
111
ArrayProperty<T, A>
(
const
Getter
&pGet,
const
Setter
&pSet)
112
:
Property<T>
(pGet, pSet)
113
{
114
}
115
122
A
operator []
(
int
i) {
return
this->
get
()->
operator
[](i); }
123
};
124
}
125
126
#endif
127
128
// EOF
129
VIB
VIBProperties.h
Generated on Thu Jun 20 2013 10:46:26 for VisualIB by
1.8.2