|
Boost : |
From: Alexander Nasonov (alnsn-mycop_at_[hidden])
Date: 2003-07-07 06:08:29
This framework might be interested to those who wishes to read and write
members of classes using member-names. Stuff like serialization, messaging,
automatic binding of class members with GUI/Web forms and OODBs (although
they have ODMG C++ binding).
>From user point of view it's easy. Every class is described using intuitive
class-decl-like style:
void describe_Driver(descriptor<Driver>& class_)
{
class_("Driver").derived_from<Person>()
[
member(&Driver::licence_id, "licence_id"), // note comma operator
member(&Driver::licence_issue_date, "licence_issue_date")
];
}
then it's registered:
namespace {
register_class<Driver, &describe_Driver> reg_Driver;
}
and that's all!
The framework is low level access to class and member information but it's
made using visitor, so it's very flexible and different add-ons can be
built on top of it. I implemented XML dump of objects. Currently, only
limited set of basic types are supported (int, char and std::string) but
it's easy to extend it. Pointers are not yet supported, it's a task for a
future.
Get it from here:
http://groups.yahoo.com/group/boost/files/describe_classes.tar.gz
BTW, I can imagine HTML form where members are grouped by classes (bases and
end class), types of form elements are determined automatically from member
information and pointers are represented as references. Most exciting is
that you get it using one function call! (if you described all classes
earlier).
-- Alexander Nasonov Remove minus and all between minus and at from my e-mail for timely response
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk