This repository has been archived by the owner on Jan 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 267
/
writer.h
38 lines (30 loc) · 1.67 KB
/
writer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#ifndef PROTOBUF_PHP_WRITER_H
#define PROTOBUF_PHP_WRITER_H
#include <stdint.h>
#include <stdlib.h>
typedef struct
{
uint8_t *data;
size_t pos;
size_t size;
} writer_t;
void writer_free_pack(writer_t *writer);
void writer_init(writer_t *writer);
void writer_init_ex(writer_t *writer, size_t size);
char *writer_get_pack(writer_t *writer, size_t *size);
int writer_write_double(writer_t *writer, uint64_t field_number, double value);
int writer_write_fixed32(writer_t *writer, uint64_t field_number, int32_t value);
int writer_write_fixed64(writer_t *writer, uint64_t field_number, int64_t value);
int writer_write_float(writer_t *writer, uint64_t field_number, double value);
int writer_write_int(writer_t *writer, uint64_t field_number, int64_t value);
int writer_write_signed_int(writer_t *writer, uint64_t field_number, int64_t value);
int writer_write_string(writer_t *writer, uint64_t field_number, const char *str, size_t len);
int writer_write_packed_double(writer_t *writer, uint64_t field_number, zval *values);
int writer_write_packed_fixed32(writer_t *writer, uint64_t field_number, zval *values);
int writer_write_packed_fixed64(writer_t *writer, uint64_t field_number, zval *values);
int writer_write_packed_float(writer_t *writer, uint64_t field_number, zval *values);
int writer_write_packed_int(writer_t *writer, uint64_t field_number, zval *values);
int writer_write_packed_signed_int(writer_t *writer, uint64_t field_number, zval *values);
int writer_write_packed_bool(writer_t *writer, uint64_t field_number, zval *values);
#define writer_write_message(writer, field_number, str, len) writer_write_string((writer), (field_number), (str), (len))
#endif /* PROTOBUF_PHP_WRITER_H */