2 * Copyright (c) 2018 Samsung Electronics Co., Ltd.
4 * Licensed under the Flora License, Version 1.1 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://floralicense.org/license/
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
23 typedef struct _writer writer_t;
26 * @brief writer object
36 * @brief Initializes writer object
38 * @param[in] writer writer object.
39 * @param[in] length the initial lenght of data buffer.
41 * @return 0 on success, other value on error
43 int writer_init_sized(writer_t *writer, size_t length);
46 * @brief Shutdowns writer object
48 * @param[in] writer writer object.
50 void writer_shutdown(writer_t *writer);
53 * @brief Resets writer object
55 * Resetting means that next call to write_write_* functions
56 * will write content from the begining of the buffer, overwriting
57 * any previously stored data.
59 * @param[in] writer writer object.
60 * @param[in] the position in the buffer after which next
61 * write data will be placed.
63 void writer_reset(writer_t *buf, size_t position);
66 * @brief Writes value into writer's buffer
68 * @param[in] writer writer object
69 * @param[in] value value to write into the writer's buffer
71 * @return 0 on success, other value on error.
73 int writer_write_int32(writer_t *writer, int32_t value);
76 * @brief Writes value into writer's buffer
78 * @param[in] writer writer object
79 * @param[in] value value to write into the writer's buffer
81 * @return 0 on success, other value on error.
83 int writer_write_int64(writer_t *writer, int64_t value);
86 * @brief Writes value into writer's buffer
88 * @param[in] writer writer object
89 * @param[in] value value to write into the writer's buffer
91 * @return 0 on success, other value on error.
93 int writer_write_bool(writer_t *writer, bool value);
96 * @brief Writes value into writer's buffer
98 * @param[in] writer writer object
99 * @param[in] value value to write into the writer's buffer
101 * @return 0 on success, other value on error.
103 int writer_write_char(writer_t *writer, char value);
106 * @brief Writes value into writer's buffer
108 * @param[in] writer writer object
109 * @param[in] value value to write into the writer's buffer
111 * @return 0 on success, other value on error.
113 int writer_write_string(writer_t *writer, const char *value);
115 #endif /* end of include guard: WRITER_H */