| Flutter iOS Embedder |

FlutterStandardCodecHelper.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef SHELL_PLATFORM_DARWIN_COMMON_FRAMEWORK_SOURCE_FLUTTERSTANDARDCODECHELPER_H_
6 #define SHELL_PLATFORM_DARWIN_COMMON_FRAMEWORK_SOURCE_FLUTTERSTANDARDCODECHELPER_H_
7
8 #include <CoreFoundation/CoreFoundation.h>
9 #include <stdbool.h>
10 #include <stdint.h>
11
12 #if defined(__cplusplus)
13 extern "C" {
14 #endif
15
16 // Note: Update FlutterStandardFieldIsStandardType if this changes.
17 typedef enum {
18 FlutterStandardFieldNil,
19 FlutterStandardFieldTrue,
20 FlutterStandardFieldFalse,
21 FlutterStandardFieldInt32,
22 FlutterStandardFieldInt64,
23 FlutterStandardFieldIntHex,
24 FlutterStandardFieldFloat64,
25 FlutterStandardFieldString,
26 FlutterStandardFieldUInt8Data,
27 FlutterStandardFieldInt32Data,
28 FlutterStandardFieldInt64Data,
29 FlutterStandardFieldFloat64Data,
30 FlutterStandardFieldList,
31 FlutterStandardFieldMap,
32 FlutterStandardFieldFloat32Data,
33 } FlutterStandardField;
34
35 static inline bool FlutterStandardFieldIsStandardType(uint8_t field) {
36 return field <= FlutterStandardFieldFloat32Data &&
37 field >= FlutterStandardFieldNil;
38 }
39
40 typedef enum {
41 FlutterStandardCodecObjcTypeNil,
42 FlutterStandardCodecObjcTypeNSNumber,
43 FlutterStandardCodecObjcTypeNSString,
44 FlutterStandardCodecObjcTypeFlutterStandardTypedData,
45 FlutterStandardCodecObjcTypeNSData,
46 FlutterStandardCodecObjcTypeNSArray,
47 FlutterStandardCodecObjcTypeNSDictionary,
48 FlutterStandardCodecObjcTypeUnknown,
49 } FlutterStandardCodecObjcType;
50
51 ///////////////////////////////////////////////////////////////////////////////
52 ///\name Reader Helpers
53 ///@{
54
55 void FlutterStandardCodecHelperReadAlignment(unsigned long* location,
56 uint8_t alignment);
57
58 void FlutterStandardCodecHelperReadBytes(unsigned long* location,
59 unsigned long length,
60 void* destination,
61 CFDataRef data);
62
63 uint8_t FlutterStandardCodecHelperReadByte(unsigned long* location,
64 CFDataRef data);
65
66 uint32_t FlutterStandardCodecHelperReadSize(unsigned long* location,
67 CFDataRef data);
68
69 CFStringRef FlutterStandardCodecHelperReadUTF8(unsigned long* location,
70 CFDataRef data);
71
72 CFTypeRef FlutterStandardCodecHelperReadValueOfType(
73 unsigned long* location,
74 CFDataRef data,
75 uint8_t type,
76 CFTypeRef (*ReadValue)(CFTypeRef),
77 CFTypeRef (*ReadTypedDataOfType)(FlutterStandardField, CFTypeRef),
78 CFTypeRef user_data);
79
80 ///@}
81
82 ///////////////////////////////////////////////////////////////////////////////
83 ///\name Writer Helpers
84 ///@{
85
86 void FlutterStandardCodecHelperWriteByte(CFMutableDataRef data, uint8_t value);
87
88 void FlutterStandardCodecHelperWriteBytes(CFMutableDataRef data,
89 const void* bytes,
90 unsigned long length);
91
92 void FlutterStandardCodecHelperWriteSize(CFMutableDataRef data, uint32_t size);
93
94 void FlutterStandardCodecHelperWriteAlignment(CFMutableDataRef data,
95 uint8_t alignment);
96
97 void FlutterStandardCodecHelperWriteUTF8(CFMutableDataRef data,
98 CFStringRef value);
99
100 void FlutterStandardCodecHelperWriteData(CFMutableDataRef data,
101 CFDataRef value);
102
103 bool FlutterStandardCodecHelperWriteNumber(CFMutableDataRef data,
104 CFNumberRef number);
105
106 ///@}
107
108 #if defined(__cplusplus)
109 }
110 #endif
111
112 #endif // SHELL_PLATFORM_DARWIN_COMMON_FRAMEWORK_SOURCE_FLUTTERSTANDARDCODECHELPER_H_
FlutterStandardFieldInt64
@ FlutterStandardFieldInt64
Definition: FlutterStandardCodecHelper.h:22
FlutterStandardCodecHelperWriteNumber
bool FlutterStandardCodecHelperWriteNumber(CFMutableDataRef data, CFNumberRef number)
Definition: FlutterStandardCodecHelper.cc:239
FlutterStandardFieldList
@ FlutterStandardFieldList
Definition: FlutterStandardCodecHelper.h:30
user_data
void * user_data
Definition: texture_registrar_unittests.cc:27
FlutterStandardFieldFloat64
@ FlutterStandardFieldFloat64
Definition: FlutterStandardCodecHelper.h:24
FlutterStandardCodecHelperReadBytes
void FlutterStandardCodecHelperReadBytes(unsigned long *location, unsigned long length, void *destination, CFDataRef data)
Definition: FlutterStandardCodecHelper.cc:33
FlutterStandardFieldFloat32Data
@ FlutterStandardFieldFloat32Data
Definition: FlutterStandardCodecHelper.h:32
FlutterStandardCodecObjcType
FlutterStandardCodecObjcType
Definition: FlutterStandardCodecHelper.h:40
FlutterStandardFieldInt32
@ FlutterStandardFieldInt32
Definition: FlutterStandardCodecHelper.h:21
FlutterStandardCodecHelperWriteSize
void FlutterStandardCodecHelperWriteSize(CFMutableDataRef data, uint32_t size)
Definition: FlutterStandardCodecHelper.cc:188
FlutterStandardCodecHelperWriteData
void FlutterStandardCodecHelperWriteData(CFMutableDataRef data, CFDataRef value)
Definition: FlutterStandardCodecHelper.cc:232
FlutterStandardCodecObjcTypeFlutterStandardTypedData
@ FlutterStandardCodecObjcTypeFlutterStandardTypedData
Definition: FlutterStandardCodecHelper.h:44
FlutterStandardFieldString
@ FlutterStandardFieldString
Definition: FlutterStandardCodecHelper.h:25
FlutterStandardFieldInt32Data
@ FlutterStandardFieldInt32Data
Definition: FlutterStandardCodecHelper.h:27
FlutterStandardFieldFalse
@ FlutterStandardFieldFalse
Definition: FlutterStandardCodecHelper.h:20
FlutterStandardCodecHelperWriteBytes
void FlutterStandardCodecHelperWriteBytes(CFMutableDataRef data, const void *bytes, unsigned long length)
Definition: FlutterStandardCodecHelper.cc:182
FlutterStandardFieldUInt8Data
@ FlutterStandardFieldUInt8Data
Definition: FlutterStandardCodecHelper.h:26
FlutterStandardCodecObjcTypeNSString
@ FlutterStandardCodecObjcTypeNSString
Definition: FlutterStandardCodecHelper.h:43
FlutterStandardCodecHelperWriteUTF8
void FlutterStandardCodecHelperWriteUTF8(CFMutableDataRef data, CFStringRef value)
Definition: FlutterStandardCodecHelper.cc:211
FlutterStandardFieldIsStandardType
static bool FlutterStandardFieldIsStandardType(uint8_t field)
Definition: FlutterStandardCodecHelper.h:35
FlutterStandardFieldTrue
@ FlutterStandardFieldTrue
Definition: FlutterStandardCodecHelper.h:19
FlutterStandardCodecObjcTypeNSArray
@ FlutterStandardCodecObjcTypeNSArray
Definition: FlutterStandardCodecHelper.h:46
FlutterStandardCodecHelperReadAlignment
void FlutterStandardCodecHelperReadAlignment(unsigned long *location, uint8_t alignment)
Definition: FlutterStandardCodecHelper.cc:18
FlutterStandardField
FlutterStandardField
Definition: FlutterStandardCodecHelper.h:17
FlutterStandardCodecHelperReadValueOfType
CFTypeRef FlutterStandardCodecHelperReadValueOfType(unsigned long *location, CFDataRef data, uint8_t type, CFTypeRef(*ReadValue)(CFTypeRef), CFTypeRef(*ReadTypedDataOfType)(FlutterStandardField, CFTypeRef), CFTypeRef user_data)
Definition: FlutterStandardCodecHelper.cc:103
FlutterStandardCodecHelperReadSize
uint32_t FlutterStandardCodecHelperReadSize(unsigned long *location, CFDataRef data)
Definition: FlutterStandardCodecHelper.cc:49
FlutterStandardCodecObjcTypeNSNumber
@ FlutterStandardCodecObjcTypeNSNumber
Definition: FlutterStandardCodecHelper.h:42
FlutterStandardFieldNil
@ FlutterStandardFieldNil
Definition: FlutterStandardCodecHelper.h:18
FlutterStandardFieldMap
@ FlutterStandardFieldMap
Definition: FlutterStandardCodecHelper.h:31
FlutterStandardCodecObjcTypeUnknown
@ FlutterStandardCodecObjcTypeUnknown
Definition: FlutterStandardCodecHelper.h:48
FlutterStandardCodecObjcTypeNil
@ FlutterStandardCodecObjcTypeNil
Definition: FlutterStandardCodecHelper.h:41
FlutterStandardCodecHelperWriteAlignment
void FlutterStandardCodecHelperWriteAlignment(CFMutableDataRef data, uint8_t alignment)
Definition: FlutterStandardCodecHelper.cc:201
FlutterStandardCodecHelperWriteByte
void FlutterStandardCodecHelperWriteByte(CFMutableDataRef data, uint8_t value)
Definition: FlutterStandardCodecHelper.cc:178
FlutterStandardFieldFloat64Data
@ FlutterStandardFieldFloat64Data
Definition: FlutterStandardCodecHelper.h:29
FlutterStandardCodecObjcTypeNSDictionary
@ FlutterStandardCodecObjcTypeNSDictionary
Definition: FlutterStandardCodecHelper.h:47
FlutterStandardCodecHelperReadByte
uint8_t FlutterStandardCodecHelperReadByte(unsigned long *location, CFDataRef data)
Definition: FlutterStandardCodecHelper.cc:42
FlutterStandardFieldInt64Data
@ FlutterStandardFieldInt64Data
Definition: FlutterStandardCodecHelper.h:28
FlutterStandardCodecHelperReadUTF8
CFStringRef FlutterStandardCodecHelperReadUTF8(unsigned long *location, CFDataRef data)
Definition: FlutterStandardCodecHelper.cc:75
FlutterStandardCodecObjcTypeNSData
@ FlutterStandardCodecObjcTypeNSData
Definition: FlutterStandardCodecHelper.h:45
FlutterStandardFieldIntHex
@ FlutterStandardFieldIntHex
Definition: FlutterStandardCodecHelper.h:23