Flutter macOS Embedder
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
FlutterStandardWriter Class Reference

#import <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:
 

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

◆ 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)

◆ 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)

◆ 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)

◆ 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 {
348  FlutterStandardCodecObjcType type = GetWriteType(value);
349  WriteValueOfType((__bridge CFTypeRef)self, (__bridge CFMutableDataRef)self->_data, type,
350  (__bridge CFTypeRef)value);
351 }
FlutterStandardCodecObjcType

References FlutterStandardTypedData::data, FlutterStandardTypedData::elementCount, FlutterStandardTypedData::elementSize, FlutterStandardCodecHelperWriteAlignment(), FlutterStandardCodecHelperWriteByte(), FlutterStandardCodecHelperWriteData(), FlutterStandardCodecHelperWriteNumber(), FlutterStandardCodecHelperWriteSize(), FlutterStandardCodecHelperWriteUTF8(), FlutterStandardCodecObjcTypeFlutterStandardTypedData, FlutterStandardCodecObjcTypeNil, FlutterStandardCodecObjcTypeNSArray, FlutterStandardCodecObjcTypeNSData, FlutterStandardCodecObjcTypeNSDictionary, FlutterStandardCodecObjcTypeNSNumber, FlutterStandardCodecObjcTypeNSString, FlutterStandardCodecObjcTypeUnknown, flutter::FlutterStandardFieldForDataType(), FlutterStandardFieldList, FlutterStandardFieldMap, FlutterStandardFieldNil, FlutterStandardFieldString, FlutterStandardTypedData::type, and WriteKeyValuesInfo::writer.


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