Real Time Open Sound Control librtosc
pretty-format.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 Johannes Lorenz
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice (including the next
12  * paragraph) shall be included in all copies or substantial portions of the
13  * Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19  * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  * DEALINGS IN THE SOFTWARE.
23  */
24 
32 #ifndef RTOSC_PRETTY_FORMAT
33 #define RTOSC_PRETTY_FORMAT
34 
35 #include <rtosc/rtosc.h>
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
41 typedef struct
42 {
43  bool lossless;
44  int floating_point_precision;
45  const char* sep;
46  int linelength;
47  int compress_ranges;
49 
62 size_t rtosc_print_arg_val(const rtosc_arg_val_t* arg, char* buffer,
63  size_t buffersize, const rtosc_print_options* opt,
64  int* cols_used);
65 
74 size_t rtosc_print_arg_vals(const rtosc_arg_val_t *args, size_t n,
75  char *buffer, size_t bs,
76  const rtosc_print_options* opt,
77  int cols_used);
78 
94 size_t rtosc_print_message(const char* address,
95  const rtosc_arg_val_t *args, size_t n,
96  char *buffer, size_t bs,
97  const rtosc_print_options* opt,
98  int cols_used);
99 
115 const char* rtosc_skip_next_printed_arg(const char* src, int* skipped,
116  char* type, const char* llhssrc,
117  int follow_ellipsis, int inside_bundle);
118 
131 int rtosc_count_printed_arg_vals(const char* src);
132 
142 int rtosc_count_printed_arg_vals_of_msg(const char* msg);
143 
163 size_t rtosc_scan_arg_val(const char* src,
164  rtosc_arg_val_t *arg, size_t n,
165  char* buffer_for_strings, size_t* bufsize,
166  size_t args_before, int follow_ellipsis);
167 
177 size_t rtosc_scan_arg_vals(const char* src,
178  rtosc_arg_val_t *args, size_t n,
179  char* buffer_for_strings, size_t bufsize);
180 
199 size_t rtosc_scan_message(const char* src,
200  char* address, size_t adrsize,
201  rtosc_arg_val_t *args, size_t n,
202  char* buffer_for_strings, size_t bufsize);
203 
204 #ifdef __cplusplus
205 }
206 #endif
207 #endif // RTOSC_PRETTY_FORMAT
Definition: pretty-format.h:41
const char * sep
separator for multiple argument values
Definition: pretty-format.h:45
int rtosc_count_printed_arg_vals(const char *src)
Count arguments that would be scanned and do a complete syntax check.
const char * rtosc_skip_next_printed_arg(const char *src, int *skipped, char *type, const char *llhssrc, int follow_ellipsis, int inside_bundle)
Skip characters from a string until one argument value would have been scanned.
Definition: rtosc.h:86
int rtosc_count_printed_arg_vals_of_msg(const char *msg)
Count arguments of a message that would be scanned and do a complete syntax check.
size_t rtosc_scan_message(const char *src, char *address, size_t adrsize, rtosc_arg_val_t *args, size_t n, char *buffer_for_strings, size_t bufsize)
Scan an OSC message from a string.
size_t rtosc_print_arg_val(const rtosc_arg_val_t *arg, char *buffer, size_t buffersize, const rtosc_print_options *opt, int *cols_used)
Pretty-print rtosct_arg_val_t structure into buffer.
size_t rtosc_print_message(const char *address, const rtosc_arg_val_t *args, size_t n, char *buffer, size_t bs, const rtosc_print_options *opt, int cols_used)
Pretty-print OSC message into string buffer.
Functions handling messages and arguments.
size_t rtosc_scan_arg_val(const char *src, rtosc_arg_val_t *arg, size_t n, char *buffer_for_strings, size_t *bufsize, size_t args_before, int follow_ellipsis)
Scan one argument value from a string.
bool lossless
will add hex notation behind floats
Definition: pretty-format.h:43
size_t rtosc_scan_arg_vals(const char *src, rtosc_arg_val_t *args, size_t n, char *buffer_for_strings, size_t bufsize)
Scan a fixed number of argument values from a string.
size_t rtosc_print_arg_vals(const rtosc_arg_val_t *args, size_t n, char *buffer, size_t bs, const rtosc_print_options *opt, int cols_used)
Pretty-print rtosct_arg_val_t array into buffer.