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 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)
36  // NOLINTEND(readability-identifier-naming)
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)
54  // NOLINTEND(readability-identifier-naming)
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 
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_
FlutterStandardFieldInt64
@ FlutterStandardFieldInt64
Definition: FlutterStandardCodecHelper.h:25
FlutterStandardCodecHelperWriteNumber
bool FlutterStandardCodecHelperWriteNumber(CFMutableDataRef data, CFNumberRef number)
Definition: FlutterStandardCodecHelper.cc:239
FlutterStandardFieldList
@ FlutterStandardFieldList
Definition: FlutterStandardCodecHelper.h:33
user_data
void * user_data
Definition: texture_registrar_unittests.cc:27
FlutterStandardFieldFloat64
@ FlutterStandardFieldFloat64
Definition: FlutterStandardCodecHelper.h:27
FlutterStandardCodecHelperReadBytes
void FlutterStandardCodecHelperReadBytes(unsigned long *location, unsigned long length, void *destination, CFDataRef data)
Definition: FlutterStandardCodecHelper.cc:33
FlutterStandardFieldFloat32Data
@ FlutterStandardFieldFloat32Data
Definition: FlutterStandardCodecHelper.h:35
FlutterStandardCodecObjcType
FlutterStandardCodecObjcType
Definition: FlutterStandardCodecHelper.h:44
FlutterStandardFieldInt32
@ FlutterStandardFieldInt32
Definition: FlutterStandardCodecHelper.h:24
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:49
FlutterStandardFieldString
@ FlutterStandardFieldString
Definition: FlutterStandardCodecHelper.h:28
FlutterStandardFieldInt32Data
@ FlutterStandardFieldInt32Data
Definition: FlutterStandardCodecHelper.h:30
FlutterStandardFieldFalse
@ FlutterStandardFieldFalse
Definition: FlutterStandardCodecHelper.h:23
FlutterStandardCodecHelperWriteBytes
void FlutterStandardCodecHelperWriteBytes(CFMutableDataRef data, const void *bytes, unsigned long length)
Definition: FlutterStandardCodecHelper.cc:182
FlutterStandardFieldUInt8Data
@ FlutterStandardFieldUInt8Data
Definition: FlutterStandardCodecHelper.h:29
FlutterStandardCodecObjcTypeNSString
@ FlutterStandardCodecObjcTypeNSString
Definition: FlutterStandardCodecHelper.h:48
FlutterStandardCodecHelperWriteUTF8
void FlutterStandardCodecHelperWriteUTF8(CFMutableDataRef data, CFStringRef value)
Definition: FlutterStandardCodecHelper.cc:211
FlutterStandardFieldIsStandardType
static bool FlutterStandardFieldIsStandardType(uint8_t field)
Definition: FlutterStandardCodecHelper.h:39
FlutterStandardFieldTrue
@ FlutterStandardFieldTrue
Definition: FlutterStandardCodecHelper.h:22
FlutterStandardCodecObjcTypeNSArray
@ FlutterStandardCodecObjcTypeNSArray
Definition: FlutterStandardCodecHelper.h:51
FlutterStandardCodecHelperReadAlignment
void FlutterStandardCodecHelperReadAlignment(unsigned long *location, uint8_t alignment)
Definition: FlutterStandardCodecHelper.cc:18
FlutterStandardField
FlutterStandardField
Definition: FlutterStandardCodecHelper.h:19
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:47
FlutterStandardFieldNil
@ FlutterStandardFieldNil
Definition: FlutterStandardCodecHelper.h:21
FlutterStandardFieldMap
@ FlutterStandardFieldMap
Definition: FlutterStandardCodecHelper.h:34
FlutterStandardCodecObjcTypeUnknown
@ FlutterStandardCodecObjcTypeUnknown
Definition: FlutterStandardCodecHelper.h:53
FlutterStandardCodecObjcTypeNil
@ FlutterStandardCodecObjcTypeNil
Definition: FlutterStandardCodecHelper.h:46
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:32
FlutterStandardCodecObjcTypeNSDictionary
@ FlutterStandardCodecObjcTypeNSDictionary
Definition: FlutterStandardCodecHelper.h:52
FlutterStandardCodecHelperReadByte
uint8_t FlutterStandardCodecHelperReadByte(unsigned long *location, CFDataRef data)
Definition: FlutterStandardCodecHelper.cc:42
FlutterStandardFieldInt64Data
@ FlutterStandardFieldInt64Data
Definition: FlutterStandardCodecHelper.h:31
FlutterStandardCodecHelperReadUTF8
CFStringRef FlutterStandardCodecHelperReadUTF8(unsigned long *location, CFDataRef data)
Definition: FlutterStandardCodecHelper.cc:75
FlutterStandardCodecObjcTypeNSData
@ FlutterStandardCodecObjcTypeNSData
Definition: FlutterStandardCodecHelper.h:50
FlutterStandardFieldIntHex
@ FlutterStandardFieldIntHex
Definition: FlutterStandardCodecHelper.h:26