Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2004-03-03 12:25:07


Max Motovilov wrote:
> "Peter Dimov" <pdimov_at_[hidden]> wrote in message
> news:00ac01c4013e$6d63e580$1d00a8c0_at_pdimov2...
>
>> That a XML resource description is needed almost goes without
>> saying, but why interpret or compile it? The GUI library should just
>> be able to deserialize its objects from such an XML file (or any
>> other archive, for that matter).
>>
>> widget w = create_widget("description.xml");
>
> That is an option, but I'd have to think for a while to offer a
> coherent theory why it may not be sufficient. In the meanwhile, I'll
> just name a capability that can be trivially implemented with a
> centralized run-time schema repository as opposed to a decentralized
> collection of objects
> created by de-serialization of such schema: support for the "ID" tag.
> That is, being able to write:
>
> list_widget lw = find_named_widget( "ListOfNames" );
>
> or something to the same effect. Doing it as:
>
> list_widget lw = root->find( "EmployeeData" )->find(
> "PersonalDataPage" )->find( "ListOfNames" );
>
> doesn't cut it [...]

    list_widget lw = cast<list_widget>( root->find_by_name("ListOfNames") );

works for me. David's current implementation doesn't attach names to widgets
but that's easily correctable.

A global find_by_name is too limited; it doesn't let you resolve collisions,
for example. If you only want a centralized repository, just use a global
'root' variable.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk