2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
20 #ifndef _THRIFT_COMPACT_PROTOCOL_H
21 #define _THRIFT_COMPACT_PROTOCOL_H
24 #include <glib-object.h>
26 #include <thrift/c_glib/protocol/thrift_protocol.h>
27 #include <thrift/c_glib/transport/thrift_transport.h>
31 /*! \file thrift_compact_protocol.h
32 * \brief Compact protocol implementation of a Thrift protocol. Implements the
33 * ThriftProtocol interface.
37 #define THRIFT_TYPE_COMPACT_PROTOCOL (thrift_compact_protocol_get_type ())
38 #define THRIFT_COMPACT_PROTOCOL(obj) \
39 (G_TYPE_CHECK_INSTANCE_CAST ((obj), THRIFT_TYPE_COMPACT_PROTOCOL, \
40 ThriftCompactProtocol))
41 #define THRIFT_IS_COMPACT_PROTOCOL(obj) \
42 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), THRIFT_TYPE_COMPACT_PROTOCOL))
43 #define THRIFT_COMPACT_PROTOCOL_CLASS(c) \
44 (G_TYPE_CHECK_CLASS_CAST ((c), THRIFT_TYPE_COMPACT_PROTOCOL, \
45 ThriftCompactProtocolClass))
46 #define THRIFT_IS_COMPACT_PROTOCOL_CLASS(c) \
47 (G_TYPE_CHECK_CLASS_TYPE ((c), THRIFT_TYPE_COMPACT_PROTOCOL))
48 #define THRIFT_COMPACT_PROTOCOL_GET_CLASS(obj) \
49 (G_TYPE_INSTANCE_GET_CLASS ((obj), THRIFT_TYPE_COMPACT_PROTOCOL, \
50 ThriftCompactProtocolClass))
53 typedef struct _ThriftCompactProtocol ThriftCompactProtocol
;
56 * Thrift Compact Protocol instance.
58 struct _ThriftCompactProtocol
60 ThriftProtocol parent
;
64 gint32 container_limit
;
69 * (Writing) If we encounter a boolean field begin, save the TField here
70 * so it can have the value incorporated.
72 const gchar
* _bool_field_name
;
73 ThriftType _bool_field_type
;
74 gint16 _bool_field_id
;
77 * (Reading) If we read a field header, and it's a boolean field, save
78 * the boolean value here so that read_bool can use it.
80 gboolean _has_bool_value
;
84 * Used to keep track of the last field for the current and previous structs,
85 * so we can do the delta stuff.
89 gint16 _last_field_id
;
92 typedef struct _ThriftCompactProtocolClass ThriftCompactProtocolClass
;
95 * Thrift Compact Protocol class.
97 struct _ThriftCompactProtocolClass
99 ThriftProtocolClass parent
;
102 /* used by THRIFT_TYPE_COMPACT_PROTOCOL */
103 GType
thrift_compact_protocol_get_type (void);
107 #endif /* _THRIFT_COMPACT_PROTOCOL_H */