[Y-devel] Slider widget done
Andrew Suffield asuffield at debian.org
Wed Mar 10 20:00:11 GMT 2004
On Wed, Mar 10, 2004 at 08:05:17PM +0100, Jerome Laheurte wrote:
> > > > > There's also a 'IntegerProperty' class, of course.
> > > >
> > > > Templates, damn you. That's what they're for.
> > >
> > > Well, I first tried with templates, but I let it go because I'm not
> > > aware of a way to specify a "transformation function" in a template
> > > (for instance, atol(3) in the case of integer properties).
> >
> > Template specialisation. It's not exactly high-level stuff.
>
> How do you specialize a template on an actual value, instead of a
> type? I'd really like to know, if it's feasible.
>
> To make myself clear, I need to have a <class T, whatever> template in
> which the
>
> operator T ()
>
> method will do
>
> return foobar(whatever(value))
>
> where 'whatever' should be
>
> * identity (string property)
> * atol() (integer property)
template <> std::string Y::Object::Property<std::string>::Value::value()
{
return rep->value()[1].string();
}
template <> uint32_t Y::Object::Property<uint32_t>::Value::value()
{
return rep->value()[1].uint32();
}
(Not quite compatible with my earlier class definition, but close enough)
Geez, now I've practically implemented the whole thing.
> > > I choose this approach instead of a more traditionnal get/set method
> > > pair because
> > >
> > > 1) I'm too used to Python :)
> > >
> > > 2) That's what's being done elsewhere (in Borland C++ Builder through
> > > proprietary extensions to C++, and in Qt 3.x through a method I don't
> > > know but which is probably very similar to mine).
> >
> > Which might make sense if it were a get/set pair, but it isn't. Reads
> > are a two-step process. libYc++ does not pretend to be a remote object
> > system.
>
> Once again, I don't understand this 'two-step process' thing. Would
> you care to explain, please ?
First you request the value. Then later, you receive it and process
it. Immediately blocking is not an option. Everything must expose an
interface for asynchronous responses, which will usually be a
lightweight wrapper around Y::Reply.
--
.''`. ** Debian GNU/Linux ** | Andrew Suffield
: :' : https://www.debian.org/ |
`. `' |
`- -><- |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : https://www.y-windows.org/pipermail/y-devel/attachments/20040310/ed8ec4ee/attachment-0001.bin
More information about the Y-devel mailing list
2026 © www.Y-Windows.Org - All Rights Reserved