| Flutter macOS 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 FLUTTER_SHELL_PLATFORM_DARWIN_COMMON_FRAMEWORK_SOURCE_FLUTTERSTANDARDCODECHELPER_H_
6 #define FLUTTER_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 // NOLINTBEGIN(google-runtime-int)
17
18 // Note: Update FlutterStandardFieldIsStandardType if this changes.
19 typedef enum {
20 // NOLINTBEGIN(readability-identifier-naming)
21 FlutterStandardFieldNil,
22 FlutterStandardFieldTrue,
23 FlutterStandardFieldFalse,
24 FlutterStandardFieldInt32,
25 FlutterStandardFieldInt64,
26 FlutterStandardFieldIntHex,
27 FlutterStandardFieldFloat64,
28 FlutterStandardFieldString,
29 FlutterStandardFieldUInt8Data,
30 FlutterStandardFieldInt32Data,
31 FlutterStandardFieldInt64Data,
32 FlutterStandardFieldFloat64Data,
33 FlutterStandardFieldList,
34 FlutterStandardFieldMap,
35 FlutterStandardFieldFloat32Data,
36 // NOLINTEND(readability-identifier-naming)
37 } FlutterStandardField;
38
39 static inline bool FlutterStandardFieldIsStandardType(uint8_t field) {
40 return field <= FlutterStandardFieldFloat32Data &&
41 field >= FlutterStandardFieldNil;
42 }
43
44 typedef enum {
45 // NOLINTBEGIN(readability-identifier-naming)
46 FlutterStandardCodecObjcTypeNil,
47 FlutterStandardCodecObjcTypeNSNumber,
48 FlutterStandardCodecObjcTypeNSString,
49 FlutterStandardCodecObjcTypeFlutterStandardTypedData,
50 FlutterStandardCodecObjcTypeNSData,
51 FlutterStandardCodecObjcTypeNSArray,
52 FlutterStandardCodecObjcTypeNSDictionary,
53 FlutterStandardCodecObjcTypeUnknown,
54 // NOLINTEND(readability-identifier-naming)
55 } FlutterStandardCodecObjcType;
56
57 // NOLINTBEGIN(google-objc-function-naming)
58
59 ///////////////////////////////////////////////////////////////////////////////
60 ///\name Reader Helpers
61 ///@{
62
63 void FlutterStandardCodecHelperReadAlignment(unsigned long* location,
64 uint8_t alignment);
65
66 void FlutterStandardCodecHelperReadBytes(unsigned long* location,
67 unsigned long length,
68 void* destination,
69 CFDataRef data);
70
71 uint8_t FlutterStandardCodecHelperReadByte(unsigned long* location,
72 CFDataRef data);
73
74 uint32_t FlutterStandardCodecHelperReadSize(unsigned long* location,
75 CFDataRef data);
76
77 CFStringRef FlutterStandardCodecHelperReadUTF8(unsigned long* location,
78 CFDataRef data);
79
80 CFTypeRef FlutterStandardCodecHelperReadValueOfType(
81 unsigned long* location,
82 CFDataRef data,
83 uint8_t type,
84 CFTypeRef (*ReadValue)(CFTypeRef),
85 CFTypeRef (*ReadTypedDataOfType)(FlutterStandardField, CFTypeRef),
86 CFTypeRef user_data);
87
88 ///@}
89
90 ///////////////////////////////////////////////////////////////////////////////
91 ///\name Writer Helpers
92 ///@{
93
94 void FlutterStandardCodecHelperWriteByte(CFMutableDataRef data, uint8_t value);
95
96 void FlutterStandardCodecHelperWriteBytes(CFMutableDataRef data,
97 const void* bytes,
98 unsigned long length);
99
100 void FlutterStandardCodecHelperWriteSize(CFMutableDataRef data, uint32_t size);
101
102 void FlutterStandardCodecHelperWriteAlignment(CFMutableDataRef data,
103 uint8_t alignment);
104
105 void FlutterStandardCodecHelperWriteUTF8(CFMutableDataRef data,
106 CFStringRef value);
107
108 void FlutterStandardCodecHelperWriteData(CFMutableDataRef data,
109 CFDataRef value);
110
111 bool FlutterStandardCodecHelperWriteNumber(CFMutableDataRef data,
112 CFNumberRef number);
113
114 ///@}
115
116 // NOLINTEND(google-objc-function-naming)
117 // NOLINTEND(google-runtime-int)
118
119 #if defined(__cplusplus)
120 }
121 #endif
122
123 #endif // FLUTTER_SHELL_PLATFORM_DARWIN_COMMON_FRAMEWORK_SOURCE_FLUTTERSTANDARDCODECHELPER_H_
FlutterStandardField
FlutterStandardField
Definition: FlutterStandardCodecHelper.h:19
FlutterStandardFieldUInt8Data
@ FlutterStandardFieldUInt8Data
Definition: FlutterStandardCodecHelper.h:29
FlutterStandardFieldFloat64
@ FlutterStandardFieldFloat64
Definition: FlutterStandardCodecHelper.h:27
FlutterStandardFieldFloat32Data
@ FlutterStandardFieldFloat32Data
Definition: FlutterStandardCodecHelper.h:35
FlutterStandardFieldIntHex
@ FlutterStandardFieldIntHex
Definition: FlutterStandardCodecHelper.h:26
FlutterStandardFieldMap
@ FlutterStandardFieldMap
Definition: FlutterStandardCodecHelper.h:34
FlutterStandardFieldInt64Data
@ FlutterStandardFieldInt64Data
Definition: FlutterStandardCodecHelper.h:31
FlutterStandardFieldList
@ FlutterStandardFieldList
Definition: FlutterStandardCodecHelper.h:33
FlutterStandardFieldInt32
@ FlutterStandardFieldInt32
Definition: FlutterStandardCodecHelper.h:24
FlutterStandardFieldNil
@ FlutterStandardFieldNil
Definition: FlutterStandardCodecHelper.h:21
FlutterStandardFieldTrue
@ FlutterStandardFieldTrue
Definition: FlutterStandardCodecHelper.h:22
FlutterStandardFieldString
@ FlutterStandardFieldString
Definition: FlutterStandardCodecHelper.h:28
FlutterStandardFieldFalse
@ FlutterStandardFieldFalse
Definition: FlutterStandardCodecHelper.h:23
FlutterStandardFieldInt32Data
@ FlutterStandardFieldInt32Data
Definition: FlutterStandardCodecHelper.h:30
FlutterStandardFieldInt64
@ FlutterStandardFieldInt64
Definition: FlutterStandardCodecHelper.h:25
FlutterStandardFieldFloat64Data
@ FlutterStandardFieldFloat64Data
Definition: FlutterStandardCodecHelper.h:32
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
FlutterStandardCodecHelperWriteNumber
bool FlutterStandardCodecHelperWriteNumber(CFMutableDataRef data, CFNumberRef number)
Definition: FlutterStandardCodecHelper.cc:239
FlutterStandardCodecHelperWriteData
void FlutterStandardCodecHelperWriteData(CFMutableDataRef data, CFDataRef value)
Definition: FlutterStandardCodecHelper.cc:232
FlutterStandardCodecHelperReadByte
uint8_t FlutterStandardCodecHelperReadByte(unsigned long *location, CFDataRef data)
Definition: FlutterStandardCodecHelper.cc:42
FlutterStandardCodecHelperWriteSize
void FlutterStandardCodecHelperWriteSize(CFMutableDataRef data, uint32_t size)
Definition: FlutterStandardCodecHelper.cc:188
FlutterStandardCodecHelperReadUTF8
CFStringRef FlutterStandardCodecHelperReadUTF8(unsigned long *location, CFDataRef data)
Definition: FlutterStandardCodecHelper.cc:75
FlutterStandardCodecHelperWriteBytes
void FlutterStandardCodecHelperWriteBytes(CFMutableDataRef data, const void *bytes, unsigned long length)
Definition: FlutterStandardCodecHelper.cc:182
FlutterStandardCodecObjcType
FlutterStandardCodecObjcType
Definition: FlutterStandardCodecHelper.h:44
FlutterStandardCodecObjcTypeNSArray
@ FlutterStandardCodecObjcTypeNSArray
Definition: FlutterStandardCodecHelper.h:51
FlutterStandardCodecObjcTypeFlutterStandardTypedData
@ FlutterStandardCodecObjcTypeFlutterStandardTypedData
Definition: FlutterStandardCodecHelper.h:49
FlutterStandardCodecObjcTypeNSData
@ FlutterStandardCodecObjcTypeNSData
Definition: FlutterStandardCodecHelper.h:50
FlutterStandardCodecObjcTypeNSString
@ FlutterStandardCodecObjcTypeNSString
Definition: FlutterStandardCodecHelper.h:48
FlutterStandardCodecObjcTypeNil
@ FlutterStandardCodecObjcTypeNil
Definition: FlutterStandardCodecHelper.h:46
FlutterStandardCodecObjcTypeUnknown
@ FlutterStandardCodecObjcTypeUnknown
Definition: FlutterStandardCodecHelper.h:53
FlutterStandardCodecObjcTypeNSDictionary
@ FlutterStandardCodecObjcTypeNSDictionary
Definition: FlutterStandardCodecHelper.h:52
FlutterStandardCodecObjcTypeNSNumber
@ FlutterStandardCodecObjcTypeNSNumber
Definition: FlutterStandardCodecHelper.h:47
FlutterStandardCodecHelperWriteUTF8
void FlutterStandardCodecHelperWriteUTF8(CFMutableDataRef data, CFStringRef value)
Definition: FlutterStandardCodecHelper.cc:211
FlutterStandardCodecHelperWriteByte
void FlutterStandardCodecHelperWriteByte(CFMutableDataRef data, uint8_t value)
Definition: FlutterStandardCodecHelper.cc:178
FlutterStandardCodecHelperReadSize
uint32_t FlutterStandardCodecHelperReadSize(unsigned long *location, CFDataRef data)
Definition: FlutterStandardCodecHelper.cc:49
FlutterStandardFieldIsStandardType
static bool FlutterStandardFieldIsStandardType(uint8_t field)
Definition: FlutterStandardCodecHelper.h:39
FlutterStandardCodecHelperReadAlignment
void FlutterStandardCodecHelperReadAlignment(unsigned long *location, uint8_t alignment)
Definition: FlutterStandardCodecHelper.cc:18
FlutterStandardCodecHelperWriteAlignment
void FlutterStandardCodecHelperWriteAlignment(CFMutableDataRef data, uint8_t alignment)
Definition: FlutterStandardCodecHelper.cc:201
FlutterStandardCodecHelperReadBytes
void FlutterStandardCodecHelperReadBytes(unsigned long *location, unsigned long length, void *destination, CFDataRef data)
Definition: FlutterStandardCodecHelper.cc:33
user_data
void * user_data
Definition: texture_registrar_unittests.cc:27