[litwindow-users] Re: User containers?
Status: Alpha
Brought to you by:
hajokirchhoff
|
From: Hajo K. <mai...@ha...> - 2005-04-21 07:15:41
|
yrs90 wrote:
> I'm not sure if I'm doing this right. I'd like to mediate access to the
> container so that I know if data has changed, possibly to filter data sent
> to views, and to provide some map-like capabilities to the vector (unique
> container, named lookup).
>
> BEGIN_ADAPTER(MyContainer)
> PROP_I(vector<MyListItem>)
> PROP_RW_FUNC(IsDirty, SetDirty, "Dirty")
> END_ADAPTER()
>
> IMPLEMENT_ADAPTER_CONTAINER(vector<MyListItem>)
>
> class ... {
> MyContainer m_list;
> };
>
> BEGIN_ADAPTER(...)
> PROP(m_list)
> END_ADAPTER()
This should work, as far as I can see from studying the
IMPLEMENT_ADAPTER_CONTAINER define. This define inserts code for a
get_prop_type(const vector<MyListItem>*) function and if you pass a
MyContainer object to it, the compiler should automatically cast this to
vector<MyListItem>.
>
> By the way, in order to do this I had to insert a space before the closing
> bracket of the PROP_I macro to avoid >>.
Fixed now, thanks. I'll check it in.
Hajo
|