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 File Reference

libyang output structures and functions More...

#include <stdio.h>
#include <sys/types.h>
#include "log.h"
Include dependency graph for out.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define LY_PRINT_SHRINK   0x02
 Common value for data as well as schema printers to avoid formatting indentations and new lines. More...
 

Typedefs

typedef enum LY_OUT_TYPE LY_OUT_TYPE
 Types of the printer's output. More...
 
typedef ssize_t(* ly_write_clb )(void *user_data, const void *buf, size_t count)
 Generic write callback for data printed by libyang. More...
 

Enumerations

enum  LY_OUT_TYPE {
  LY_OUT_ERROR = -1, LY_OUT_FD, LY_OUT_FDSTREAM, LY_OUT_FILE,
  LY_OUT_FILEPATH, LY_OUT_MEMORY, LY_OUT_CALLBACK
}
 Types of the printer's output. More...
 

Functions

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. More...
 
LIBYANG_API_DECL void * ly_out_clb_arg (struct ly_out *out, void *arg)
 Get or reset callback function's argument associated with a callback printer handler. More...
 
LIBYANG_API_DECL int ly_out_fd (struct ly_out *out, int fd)
 Get or reset file descriptor printer handler. More...
 
LIBYANG_API_DECL FILE * ly_out_file (struct ly_out *out, FILE *f)
 Get or reset file stream printer handler. More...
 
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. More...
 
LIBYANG_API_DECL void ly_out_free (struct ly_out *out, void(*clb_arg_destructor)(void *arg), ly_bool destroy)
 Free the printer handler. More...
 
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. More...
 
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. More...
 
LIBYANG_API_DECL LY_ERR ly_out_new_fd (int fd, struct ly_out **out)
 Create printer handler using file descriptor. More...
 
LIBYANG_API_DECL LY_ERR ly_out_new_file (FILE *f, struct ly_out **out)
 Create printer handler using file stream. More...
 
LIBYANG_API_DECL LY_ERR ly_out_new_filepath (const char *filepath, struct ly_out **out)
 Create printer handler file of the given filename. More...
 
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. More...
 
LIBYANG_API_DECL size_t ly_out_printed (const struct ly_out *out)
 Get the number of printed bytes by the last function. More...
 
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. More...
 
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 the current data instead of appending. More...
 
LIBYANG_API_DECL LY_OUT_TYPE ly_out_type (const struct ly_out *out)
 Get output type of the printer handler. More...
 
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. More...
 
LIBYANG_API_DECL void ly_print_flush (struct ly_out *out)
 Flush the output from any internal buffers and clean any auxiliary data. More...
 
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. More...
 

Detailed Description

libyang output structures and functions

Author
Radek Krejci rkrej.nosp@m.ci@c.nosp@m.esnet.nosp@m..cz
Michal Vasko mvask.nosp@m.o@ce.nosp@m.snet..nosp@m.cz Copyright (c) 2015 - 2025 CESNET, z.s.p.o.

This source code is licensed under BSD 3-Clause License (the "License"). You may not use this file except in compliance with the License. You may obtain a copy of the License at

https://opensource.org/licenses/BSD-3-Clause

Definition in file out.h.