|
From: | Anthony Liguori |
Subject: | Re: [Qemu-devel] [PATCH 01/10] Introduce qmisc module |
Date: | Thu, 15 Oct 2009 10:35:16 -0500 |
User-agent: | Thunderbird 2.0.0.23 (X11/20090825) |
Luiz Capitulino wrote:
Okay, I'd like to see that and I'd like to see string parsing. We can rewrite the parser later.But my real objection is that we should make this "{%s: [%d, %s], %s: %d}" so that we can mark it as a printf formatted function and get type checking. You'll probably have to support both "%d" and "%" PRId64 for sanity sake.+/** + * qobject_from_fmt(): build QObjects from a specified format. + * + * Valid characters of the format: + * + * i integer, map to QInt + * s string, map to QString + * [] list, map to QList + * {} dictionary, map to QDict + * + * Examples: + * + * - Create a QInt + * + * qobject_from_fmt("i", 42); + * + * - Create a QList of QStrings + * + * qobject_from_fmt("[ i, i, i ]", 0, 1 , 2); + * + * - Create a QDict with mixed data-types + * + * qobject_from_fmt("{ s: [ i, s ], s: i }", ... ); + * + * Return a strong reference to a QObject on success, NULL otherwise. + */Trivial to do if we ignore the '%' characters. :))
Regards, Anthony Liguori
[Prev in Thread] | Current Thread | [Next in Thread] |