libyang  3.12.9
libyang is YANG data modelling language parser and toolkit written (and providing API) in C.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
out.h
Go to the documentation of this file.
1 
16 #ifndef LY_OUT_H_
17 #define LY_OUT_H_
18 
19 #include <stdio.h>
20 #include <sys/types.h>
21 #ifdef _MSC_VER
22 # define ssize_t SSIZE_T
23 #endif
24 
25 #include "log.h"
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
95 struct ly_out;
96 
100 #define LY_PRINT_SHRINK 0x02
101 
105 typedef enum LY_OUT_TYPE {
113 } LY_OUT_TYPE;
114 
121 LIBYANG_API_DECL LY_OUT_TYPE ly_out_type(const struct ly_out *out);
122 
136 LIBYANG_API_DECL LY_ERR ly_out_reset(struct ly_out *out);
137 
147 typedef ssize_t (*ly_write_clb)(void *user_data, const void *buf, size_t count);
148 
158 LIBYANG_API_DECL LY_ERR ly_out_new_clb(ly_write_clb writeclb, void *user_data, struct ly_out **out);
159 
168 LIBYANG_API_DECL ly_write_clb ly_out_clb(struct ly_out *out, ly_write_clb writeclb);
169 
178 LIBYANG_API_DECL void *ly_out_clb_arg(struct ly_out *out, void *arg);
179 
188 LIBYANG_API_DECL LY_ERR ly_out_new_fd(int fd, struct ly_out **out);
189 
198 LIBYANG_API_DECL int ly_out_fd(struct ly_out *out, int fd);
199 
208 LIBYANG_API_DECL LY_ERR ly_out_new_file(FILE *f, struct ly_out **out);
209 
217 LIBYANG_API_DECL FILE *ly_out_file(struct ly_out *out, FILE *f);
218 
230 LIBYANG_API_DECL LY_ERR ly_out_new_memory(char **strp, size_t size, struct ly_out **out);
231 
242 LIBYANG_API_DECL char *ly_out_memory(struct ly_out *out, char **strp, size_t size);
243 
252 LIBYANG_API_DECL LY_ERR ly_out_new_filepath(const char *filepath, struct ly_out **out);
253 
266 LIBYANG_API_DECL const char *ly_out_filepath(struct ly_out *out, const char *filepath);
267 
277 LIBYANG_API_DECL LY_ERR ly_print(struct ly_out *out, const char *format, ...);
278 
283 LIBYANG_API_DECL void ly_print_flush(struct ly_out *out);
284 
295 LIBYANG_API_DECL LY_ERR ly_write(struct ly_out *out, const char *buf, size_t len);
296 
303 LIBYANG_API_DECL size_t ly_out_printed(const struct ly_out *out);
304 
311 LIBYANG_API_DECL size_t ly_out_printed_total(const struct ly_out *out);
312 
320 LIBYANG_API_DECL void ly_out_free(struct ly_out *out, void (*clb_arg_destructor)(void *arg), ly_bool destroy);
321 
324 #ifdef __cplusplus
325 }
326 #endif
327 
328 #endif /* LY_OUT_H_ */
LIBYANG_API_DECL char * ly_out_memory(struct ly_out *out, char **strp, size_t size)
Get or change memory where the data are dumped.
LIBYANG_API_DECL size_t ly_out_printed(const struct ly_out *out)
Get the number of printed bytes by the last function.
uint8_t ly_bool
Type to indicate boolean value.
Definition: log.h:28
LIBYANG_API_DECL LY_ERR ly_out_new_clb(ly_write_clb writeclb, void *user_data, struct ly_out **out)
Create printer handler using callback printer function.
LIBYANG_API_DECL LY_ERR ly_out_new_file(FILE *f, struct ly_out **out)
Create printer handler using file stream.
LIBYANG_API_DECL void * ly_out_clb_arg(struct ly_out *out, void *arg)
Get or reset callback function&#39;s argument associated with a callback printer handler.
LIBYANG_API_DECL LY_ERR ly_out_new_filepath(const char *filepath, struct ly_out **out)
Create printer handler file of the given filename.
LIBYANG_API_DECL ly_write_clb ly_out_clb(struct ly_out *out, ly_write_clb writeclb)
Get or reset callback function associated with a callback printer handler.
LIBYANG_API_DECL LY_OUT_TYPE ly_out_type(const struct ly_out *out)
Get output type of the printer handler.
LIBYANG_API_DECL LY_ERR ly_write(struct ly_out *out, const char *buf, size_t len)
Generic printer of the given string buffer into the specified output.
Printer output structure specifying the type of data output.
LIBYANG_API_DECL LY_ERR ly_out_reset(struct ly_out *out)
Reset the output medium to write from its beginning, so the following printer function will rewrite t...
LIBYANG_API_DECL void ly_out_free(struct ly_out *out, void(*clb_arg_destructor)(void *arg), ly_bool destroy)
Free the printer handler.
Definition: out.h:107
LIBYANG_API_DECL LY_ERR ly_out_new_fd(int fd, struct ly_out **out)
Create printer handler using file descriptor.
LIBYANG_API_DECL int ly_out_fd(struct ly_out *out, int fd)
Get or reset file descriptor printer handler.
ssize_t(* ly_write_clb)(void *user_data, const void *buf, size_t count)
Generic write callback for data printed by libyang.
Definition: out.h:147
LIBYANG_API_DECL LY_ERR ly_print(struct ly_out *out, const char *format,...)
Generic printer of the given format string into the specified output.
LIBYANG_API_DECL void ly_print_flush(struct ly_out *out)
Flush the output from any internal buffers and clean any auxiliary data.
LY_OUT_TYPE
Types of the printer&#39;s output.
Definition: out.h:105
LIBYANG_API_DECL const char * ly_out_filepath(struct ly_out *out, const char *filepath)
Get or change the filepath of the file where the printer prints the data.
Logger manipulation routines and error definitions.
LIBYANG_API_DECL LY_ERR ly_out_new_memory(char **strp, size_t size, struct ly_out **out)
Create printer handler using memory to dump data.
LIBYANG_API_DECL FILE * ly_out_file(struct ly_out *out, FILE *f)
Get or reset file stream printer handler.
LY_ERR
libyang&#39;s error codes returned by the libyang functions.
Definition: log.h:240
LIBYANG_API_DECL size_t ly_out_printed_total(const struct ly_out *out)
Get the total number of printed bytes of this out structure.