[Development] unified data model API in QtCore => thin wrapper proposal
Tor Arne Vestbø
Tor.arne.Vestbo at qt.io
Sun Sep 9 13:16:24 CEST 2018
> On 9 Sep 2018, at 12:25, Sze Howe Koh <szehowe.koh at gmail.com> wrote:
>
> Hi Thiago,
>
> On Sat, 18 Aug 2018 at 01:51, Thiago Macieira <thiago.macieira at intel.com> wrote:
>>
>> On Friday, 17 August 2018 08:13:21 PDT Tor Arne Vestbø wrote:
>>>> Now, looking at the code, I don't think it does work. I thought that
>>>> QCborValue::operator[] returned QCborValueRefs, but it doesn't. Adding a
>>>> set of non-const overloads returning QCborValueRef might be the trick.
>>> That would be great to have as part of the API yes
>>
>> I won't have time to experiment with it before feature freeze. Technically,
>> the API freeze doesn't happen until Beta, so we have a few more weeks, but I
>> wouldn't hold my hopes up that I will have time to trial this.
>>
>> Any chance you can give it a go? Or someone else?
>
> I've installed the Qt 5.12 alpha for MSVC 2015 and started playing
> with the CBOR API.
>
> map["hello"] = foo; // ERROR C2593: Operator '[' is ambiguous
> map[QString("hello")] = foo; // OK
>
> The ambiguity disappears if I remove either operator[](const QString&)
> OR operator[](const QCborValue&). Oddly, operator[](QLatin1String)
> doesn't matter. Why's that?
>
> Also, chained operator[] currently doesn't work because
> QCborValueRef::operator[](...) doesn't exist:
>
> qDebug() << array[1]; // OK
> qDebug() << array[1][2]; // ERROR C2676: 'QCborValueRef' does not
> define this operator or a conversion to a type acceptable to the
> predefined operator
This is exactly the kind of stuff I brought up at the contributors summit. We should strive to at least be on par with QJson, but I’m hoping we can also have a nice API for writing (something QJson doesn’t easily facilitate). Any chance the read-only stuff can be added at least Thiago?
Tor Arne
More information about the Development
mailing list