]> err.no Git - sope/blob - sope-core/NGStreams/NGActiveSocket+serialization.m
Drop apache 1 build-dependency
[sope] / sope-core / NGStreams / NGActiveSocket+serialization.m
1 /*
2   Copyright (C) 2000-2005 SKYRIX Software AG
3
4   This file is part of SOPE.
5
6   SOPE is free software; you can redistribute it and/or modify it under
7   the terms of the GNU Lesser General Public License as published by the
8   Free Software Foundation; either version 2, or (at your option) any
9   later version.
10
11   SOPE is distributed in the hope that it will be useful, but WITHOUT ANY
12   WARRANTY; without even the implied warranty of MERCHANTABILITY or
13   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
14   License for more details.
15
16   You should have received a copy of the GNU Lesser General Public
17   License along with SOPE; see the file COPYING.  If not, write to the
18   Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19   02111-1307, USA.
20 */
21
22 #include "NGActiveSocket+serialization.h"
23 #include "common.h"
24
25 @implementation NGActiveSocket(serialization)
26
27 // serialization
28
29 - (void)serializeChar:(char)_value {
30   NGStreamSerializeObjC(self, &_value, @encode(char), nil);
31 }
32 - (void)serializeShort:(short)_value {
33   NGStreamSerializeObjC(self, &_value, @encode(short), nil);
34 }
35 - (void)serializeInt:(int)_value {
36   NGStreamSerializeObjC(self, &_value, @encode(int), nil);
37 }
38 - (void)serializeLong:(long)_value {
39   NGStreamSerializeObjC(self, &_value, @encode(long), nil);
40 }
41
42 - (void)serializeFloat:(float)_value {
43   NGStreamSerializeObjC(self, &_value, @encode(float), nil);
44 }
45 - (void)serializeDouble:(double)_value {
46   NGStreamSerializeObjC(self, &_value, @encode(double), nil);
47 }
48 - (void)serializeLongLong:(long long)_value {
49   NGStreamSerializeObjC(self, &_value, @encode(long long), nil);
50 }
51
52 - (void)serializeCString:(const char *)_value {
53   NGStreamSerializeObjC(self, &_value, @encode(char *), nil);
54 }
55
56 #if USE_SERIALIZER
57 - (void)serializeDataAt:(const void*)_value ofObjCType:(const char*)_type
58   context:(id<NSObjCTypeSerializationCallBack>)_callback {
59
60   NGStreamSerializeObjC(self, _value, _type, _callback);
61 }
62 #endif
63
64 // deserialization
65
66 - (char)deserializeChar {
67   char c;
68   NGStreamDeserializeObjC(self, &c, @encode(char), nil);
69   return c;
70 }
71 - (short)deserializeShort {
72   short s;
73   NGStreamDeserializeObjC(self, &s, @encode(short), nil);
74   return s;
75 }
76 - (int)deserializeInt {
77   int i;
78   NGStreamDeserializeObjC(self, &i, @encode(int), nil);
79   return i;
80 }
81 - (long)deserializeLong {
82   long l;
83   NGStreamDeserializeObjC(self, &l, @encode(long), nil);
84   return l;
85 }
86 - (float)deserializeFloat {
87   float f;
88   NGStreamDeserializeObjC(self, &f, @encode(float), nil);
89   return f;
90 }
91
92 - (double)deserializeDouble {
93   double d;
94   NGStreamDeserializeObjC(self, &d, @encode(double), nil);
95   return d;
96 }
97 - (long long)deserializeLongLong {
98   long long l;
99   NGStreamDeserializeObjC(self, &l, @encode(long long), nil);
100   return l;
101 }
102
103 - (char *)deserializeCString {
104   char *result = NULL;
105   NGStreamDeserializeObjC(self, &result, @encode(char *), nil);
106   return result;
107 }
108
109 #if USE_SERIALIZER
110 - (void)deserializeDataAt:(void *)_value ofObjCType:(const char *)_type
111   context:(id<NSObjCTypeSerializationCallBack>)_callback 
112 {
113   NGStreamDeserializeObjC(self, _value, _type, _callback);
114 }
115 #endif
116
117 @end /* NGActiveSocket(serialization) */
118
119 void __link_NGActiveSocket_serialization(void) {
120   __link_NGActiveSocket_serialization();
121 }