-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathosc_strfmt.h
79 lines (61 loc) · 2.76 KB
/
osc_strfmt.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
Written by John MacCallum, The Center for New Music and Audio Technologies,
University of California, Berkeley. Copyright (c) 2012, The Regents of
the University of California (Regents).
Permission to use, copy, modify, distribute, and distribute modified versions
of this software and its documentation without fee and without a signed
licensing agreement, is hereby granted, provided that the above copyright
notice, this paragraph and the following two paragraphs appear in all copies,
modifications, and distributions.
IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*/
/** \file osc_strfmt.h
\author John MacCallum
*/
#ifndef __OSC_STRFMT_H__
#define __OSC_STRFMT_H__
#ifdef __cplusplus
extern "C" {
#endif
#include "osc_timetag.h"
#include <inttypes.h>
#include <string.h>
#ifdef SWIG
#define OSC_DEPRECATED(decl, msg) decl;
#else
#define OSC_DEPRECATED(decl, msg) decl __attribute__((deprecated(msg)));
#endif
#define OSC_STRFMT_META_CHARS ((char []){'"', '\\'})
int osc_strfmt_int8(char *buf, size_t n, int8_t i);
int osc_strfmt_int16(char *buf, size_t n, int16_t i);
int osc_strfmt_int32(char *buf, size_t n, int32_t i);
int osc_strfmt_int64(char *buf, size_t n, int64_t i);
int osc_strfmt_uint8(char *buf, size_t n, uint8_t i);
int osc_strfmt_uint16(char *buf, size_t n, uint16_t i);
int osc_strfmt_uint32(char *buf, size_t n, uint32_t i);
int osc_strfmt_uint64(char *buf, size_t n, uint64_t i);
int osc_strfmt_float32(char *buf, size_t n, float f);
int osc_strfmt_float64(char *buf, size_t n, double f);
int osc_strfmt_bool(char *buf, size_t n, char b);
int osc_strfmt_null(char *buf, size_t n);
int osc_strfmt_timetag(char *buf, size_t n, t_osc_timetag t);
int osc_strfmt_blob(char *buf, size_t n, char *blob);
int osc_strfmt_quotedString(char *buf, size_t n, char *str);
int osc_strfmt_stringWithQuotedMeta(char *buf, size_t n, char *str);
int osc_strfmt_quotedStringWithQuotedMeta(char *buf, size_t n, char *str);
int osc_strfmt_countMeta(int len, char *buf);
int osc_strfmt_isMeta(char c);
OSC_DEPRECATED(int osc_strfmt_addQuotesAndQuoteMeta(int len, char *buf, char **out), "use osc_strfmt_quotedStringWithQuotedMeta() instead.");
int osc_strfmt_strlenPadded(char *str);
#ifdef __cplusplus
}
#endif
#endif