[Development] [Qt5-feedback] A micro API review: for V3(md5) and V5(sha1) in QUuid

João Abecasis joao.abecasis at nokia.com
Fri Dec 9 17:29:43 CET 2011


On 9. des. 2011, at 17.10, ext Denis Dzyubenko wrote:
> 2011/12/9 João Abecasis <joao.abecasis at nokia.com>:
>> This has my vote:
>> 
>>    QUuid QUuid::createFromNameV3(const QUuid &, const QByteArray &);
>>    QUuid QUuid::createFromNameV5(const QUuid &, const QByteArray &);
>> 
>>    inline QUuid QUuid::createFromName(const QUuid &ns, const QByteArray &name)
>>    {
>>        // SHA1 (v5) is recommended
>>        return createFromNameV5(ns, name);
>>    }
>> 
>>    inline QUuid QUuid::createFromName(const QUuid &ns, const QString &name)
>>    {
>>        return createFromName(ns, name.toUtf8());
>>    }
> 
> I like names createFromNameV3() ! I also think we should have api that
> takes QString (i.e. operates on utf-16 data) and QByteArray (i.e. raw
> data), and maybe even an overload that takes const char * and int size
> - for passing raw data.

Above, I already suggest versions taking QByteArray and that operate on the byte data, or did you mean something different?

And what's wrong with QByteArray::fromRawData(const char *data, int size)? (Can we do something in QByteArray improve it, for instance? That would keep everyone from having to add that one extra overload...)

Cheers,


João




More information about the Development mailing list