Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Instance Methods | Class Methods | List of all members
FlutterStandardWriter Class Reference

#include <FlutterCodecs.h>

Inheritance diagram for FlutterStandardWriter:
ExtendedWriter

Instance Methods

(instancetype) - initWithData:
 
(void) - writeByte:
 
(void) - writeBytes:length:
 
(void) - writeData:
 
(void) - writeSize:
 
(void) - writeAlignment:
 
(void) - writeUTF8:
 
(void) - writeValue:
 

Class Methods

(static FlutterStandardCodecObjcType+ GetWriteType [implementation]
 
(static void) + WriteKeyValues [implementation]
 
(static void) + FastWriteValueOfType [implementation]
 
(static void) + WriteValueOfType [implementation]
 

Detailed Description

A writer of the Flutter standard binary encoding.

See FlutterStandardMessageCodec for details on the encoding.

The encoding is extensible via subclasses overriding writeValue.

Definition at line 92 of file FlutterCodecs.h.

Method Documentation

◆ FastWriteValueOfType

+ (static void) FastWriteValueOfType (CFTypeRef)  writer
(CFMutableDataRef)  data
(CFTypeRef)  value 
implementation

Definition at line 271 of file FlutterStandardCodec.mm.

271 {
272 FlutterStandardCodecObjcType type = GetWriteType((__bridge id)value);
274 WriteValueOfType(writer, data, type, value);
275 } else {
276 [(__bridge FlutterStandardWriter*)writer writeValue:(__bridge id)value];
277 }
278}
@ FlutterStandardCodecObjcTypeUnknown
static FlutterStandardCodecObjcType GetWriteType(id value)
static void WriteValueOfType(CFTypeRef writer, CFMutableDataRef data, FlutterStandardCodecObjcType type, CFTypeRef value)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
Definition switches.h:41

◆ GetWriteType

+ (static FlutterStandardCodecObjcType) GetWriteType (id value
implementation

Definition at line 238 of file FlutterStandardCodec.mm.

238 {
239 if (value == nil || (__bridge CFNullRef)value == kCFNull) {
241 } else if ([value isKindOfClass:[NSNumber class]]) {
243 } else if ([value isKindOfClass:[NSString class]]) {
245 } else if ([value isKindOfClass:[FlutterStandardTypedData class]]) {
247 } else if ([value isKindOfClass:[NSData class]]) {
249 } else if ([value isKindOfClass:[NSArray class]]) {
251 } else if ([value isKindOfClass:[NSDictionary class]]) {
253 } else {
255 }
256}
@ FlutterStandardCodecObjcTypeNSArray
@ FlutterStandardCodecObjcTypeFlutterStandardTypedData
@ FlutterStandardCodecObjcTypeNSData
@ FlutterStandardCodecObjcTypeNSString
@ FlutterStandardCodecObjcTypeNil
@ FlutterStandardCodecObjcTypeNSDictionary
@ FlutterStandardCodecObjcTypeNSNumber

◆ initWithData:

- (instancetype) initWithData: (NSMutableData*)  data
Initial value:
{
NSMutableData* _data

Create a FlutterStandardWriter who will write to data.

Definition at line 8 of file FlutterStandardCodec.mm.

206 :(NSMutableData*)data {
207 self = [super init];
208 NSAssert(self, @"Super init cannot be nil");
209 _data = data;
210 return self;
211}

◆ writeAlignment:

- (void) writeAlignment: (UInt8)  alignment

Write zero padding until data is aligned with alignment.

Definition at line 8 of file FlutterStandardCodec.mm.

229 :(UInt8)alignment {
230 FlutterStandardCodecHelperWriteAlignment((__bridge CFMutableDataRef)_data, alignment);
231}
void FlutterStandardCodecHelperWriteAlignment(CFMutableDataRef data, uint8_t alignment)

◆ writeByte:

- (void) writeByte: (UInt8)  value

Write a 8-bit byte.

Definition at line 8 of file FlutterStandardCodec.mm.

213 :(UInt8)value {
214 FlutterStandardCodecHelperWriteByte((__bridge CFMutableDataRef)_data, value);
215}
void FlutterStandardCodecHelperWriteByte(CFMutableDataRef data, uint8_t value)

◆ writeBytes:length:

- (void) writeBytes: (const void*)  bytes
length: (NSUInteger)  length 

Write an array of bytes of size length.

Definition at line 8 of file FlutterStandardCodec.mm.

217 :(const void*)bytes length:(NSUInteger)length {
218 FlutterStandardCodecHelperWriteBytes((__bridge CFMutableDataRef)_data, bytes, length);
219}
void FlutterStandardCodecHelperWriteBytes(CFMutableDataRef data, const void *bytes, unsigned long length)
size_t length

◆ writeData:

- (void) writeData: (NSData*)  data

Write an array of bytes contained in data.

Definition at line 8 of file FlutterStandardCodec.mm.

221 :(NSData*)data {
222 FlutterStandardCodecHelperWriteData((__bridge CFMutableDataRef)_data, (__bridge CFDataRef)data);
223}
void FlutterStandardCodecHelperWriteData(CFMutableDataRef data, CFDataRef value)

◆ WriteKeyValues

+ (static void) WriteKeyValues (CFTypeRef)  key
(CFTypeRef)  value
(void *)  context 
implementation

Definition at line 263 of file FlutterStandardCodec.mm.

263 {
265 FastWriteValueOfType(info->writer, info->data, key);
266 FastWriteValueOfType(info->writer, info->data, value);
267}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition DM.cpp:213
static void FastWriteValueOfType(CFTypeRef writer, CFMutableDataRef data, CFTypeRef value)

◆ writeSize:

- (void) writeSize: (UInt32)  size

Write 32-bit unsigned integer that represents a size of a collection.

Definition at line 8 of file FlutterStandardCodec.mm.

225 :(UInt32)size {
226 FlutterStandardCodecHelperWriteSize((__bridge CFMutableDataRef)_data, size);
227}
void FlutterStandardCodecHelperWriteSize(CFMutableDataRef data, uint32_t size)
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition switches.h:259

◆ writeUTF8:

- (void) writeUTF8: (NSString*)  value

Write a string with UTF-8 encoding.

Definition at line 8 of file FlutterStandardCodec.mm.

233 :(NSString*)value {
234 FlutterStandardCodecHelperWriteUTF8((__bridge CFMutableDataRef)_data,
235 (__bridge CFStringRef)value);
236}
void FlutterStandardCodecHelperWriteUTF8(CFMutableDataRef data, CFStringRef value)

◆ writeValue:

- (void) writeValue: (id value

Introspects into an object and writes its representation.

Supported Data Types:

  • NSNull
  • NSNumber
  • NSString (as UTF-8)
  • FlutterStandardTypedData
  • NSArray of supported types
  • NSDictionary of supporte types

NSAsserts on failure.

Reimplemented in ExtendedWriter.

Definition at line 280 of file FlutterStandardCodec.mm.

347 :(id)value {
349 WriteValueOfType((__bridge CFTypeRef)self, (__bridge CFMutableDataRef)self->_data, type,
350 (__bridge CFTypeRef)value);
351}
const uintptr_t id

◆ WriteValueOfType

+ (static void) WriteValueOfType (CFTypeRef)  writer
(CFMutableDataRef)  data
(FlutterStandardCodecObjcType type
(CFTypeRef)  value 
implementation

Definition at line 280 of file FlutterStandardCodec.mm.

283 {
284 switch (type) {
287 break;
289 CFNumberRef number = (CFNumberRef)value;
291 if (!success) {
292 NSLog(@"Unsupported value: %@ of number type %ld", value, CFNumberGetType(number));
293 NSCAssert(NO, @"Unsupported value for standard codec");
294 }
295 break;
296 }
298 CFStringRef string = (CFStringRef)value;
301 break;
302 }
304 FlutterStandardTypedData* typedData = (__bridge FlutterStandardTypedData*)value;
308 FlutterStandardCodecHelperWriteData(data, (__bridge CFDataRef)typedData.data);
309 break;
310 }
313 (__bridge CFTypeRef)
314 [FlutterStandardTypedData typedDataWithBytes:(__bridge NSData*)value]);
315 break;
317 CFArrayRef array = (CFArrayRef)value;
319 CFIndex count = CFArrayGetCount(array);
321 for (CFIndex i = 0; i < count; ++i) {
322 FastWriteValueOfType(writer, data, CFArrayGetValueAtIndex(array, i));
323 }
324 break;
325 }
327 CFDictionaryRef dict = (CFDictionaryRef)value;
329 CFIndex count = CFDictionaryGetCount(dict);
332 .writer = writer,
333 .data = data,
334 };
335 CFDictionaryApplyFunction(dict, WriteKeyValues, (void*)&info);
336 break;
337 }
339 id objc_value = (__bridge id)value;
340 NSLog(@"Unsupported value: %@ of type %@", objc_value, [objc_value class]);
341 NSCAssert(NO, @"Unsupported value for standard codec");
342 break;
343 }
344 }
345}
bool FlutterStandardCodecHelperWriteNumber(CFMutableDataRef data, CFNumberRef number)
@ FlutterStandardFieldMap
@ FlutterStandardFieldList
@ FlutterStandardFieldNil
@ FlutterStandardFieldString
int count
uint8_t value
FlutterStandardDataType type
static void WriteKeyValues(CFTypeRef key, CFTypeRef value, void *context)
FlutterStandardField FlutterStandardFieldForDataType(FlutterStandardDataType type)
int BOOL

The documentation for this class was generated from the following files: