21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
*/
#import "OFData+QByteArray.h"
@implementation OFData (QByteArray)
+ (instancetype)dataWithQByteArray: (const QByteArray &)qByteArray
{
return [OFData dataWithItems: qByteArray.data()
count: qByteArray.count()];
}
- (QByteArray)qByteArray
{
return QByteArray((const char *)[self items],
[self count] * [self itemSize]);
}
|
>
>
>
>
>
|
|
|
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
*/
#import "OFData+QByteArray.h"
@implementation OFData (QByteArray)
+ (instancetype)dataWithQByteArray: (const QByteArray &)qByteArray
{
return [[[self alloc] initWithQByteArray: qByteArray] autorelease];
}
- (instancetype)initWithQByteArray: (const QByteArray &)qByteArray
{
return [self initWithItems: qByteArray.data()
count: qByteArray.count()];
}
- (QByteArray)qByteArray
{
return QByteArray((const char *)[self items],
[self count] * [self itemSize]);
}
|