mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 00:30:53 +00:00
Added encodeDataObject: and decodeDataObject
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@3622 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
669ee067b3
commit
df4f203ee5
3 changed files with 60 additions and 0 deletions
|
@ -674,6 +674,28 @@ static SEL eValSel = @selector(encodeValueOfObjCType:at:);
|
|||
}
|
||||
}
|
||||
|
||||
- (void) encodeDataObject: (NSData*)anObject
|
||||
{
|
||||
unsigned l = [anObject length];
|
||||
|
||||
(*eValImp)(self, eValSel, @encode(unsigned int), &l);
|
||||
if (l)
|
||||
{
|
||||
const void *b = [anObject bytes];
|
||||
unsigned char c = 0; /* Type tag */
|
||||
|
||||
/*
|
||||
* The type tag 'c' is used to specify an encoding scheme for the
|
||||
* actual data - at present we have '0' meaning raw data. In the
|
||||
* future we might want zipped data for instance.
|
||||
*/
|
||||
(*eValImp)(self, eValSel, @encode(unsigned char), &c);
|
||||
[self encodeArrayOfObjCType: @encode(unsigned char)
|
||||
count: l
|
||||
at: b];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) encodeObject: (id)anObject
|
||||
{
|
||||
if (anObject == nil)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue