blob: c560dbc7d19aa0e56855f0b6353fa24235c284c5 [file] [log] [blame]
E. Scott Daniels97204c82020-06-29 15:39:57 -04001// vi: ts=4 sw=4 noet:
2/*
3==================================================================================
4 Copyright (c) 2020 Nokia
5 Copyright (c) 2020 AT&T Intellectual Property.
6
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
10
11 http://www.apache.org/licenses/LICENSE-2.0
12
13 Unless required by applicable law or agreed to in writing, software
14 distributed under the License is distributed on an "AS IS" BASIS,
15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 See the License for the specific language governing permissions and
17 limitations under the License.
18==================================================================================
19*/
20
21/*
22 Mnemonic: jwrapper.h
23 Abstract: Header file for jwrapper; mostly prototypes.
24
25 Date: 26 June 2020
26 Author: E. Scott Daniels
27*/
28
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#ifndef _JWRAPPER_H
35#define _JWRAPPER_H
36
37
38//---------------- jwrapper -------------------------------------------------------------------------------
39extern void jw_nuke( void* st );
40extern void* jw_new( const char* json );
41
42extern int jw_bool_ele( void* st, const char* name, int idx );
43extern void jw_dump( void* st );
44extern int jw_missing( void* st, const char* name );
45extern int jw_exists( void* st, const char* name );
46extern char* jw_string( void* st, const char* name );
47extern double jw_value( void* st, const char* name );
48extern void* jw_blob( void* st, const char* name );
49extern char* jw_string_ele( void* st, const char* name, int idx );
50extern double jw_value_ele( void* st, const char* name, int idx );
51extern void* jw_obj_ele( void* st, const char* name, int idx );
52extern int jw_array_len( void* st, const char* name );
53
54extern int jw_is_string( void* st, const char* name );
55extern int jw_is_value( void* st, const char* name );
56extern int jw_is_bool( void* st, const char* name );
57extern int jw_is_null( void* st, const char* name );
58
59extern int jw_is_string_ele( void* st, const char* name, int idx );
60extern int jw_is_value_ele( void* st, const char* name, int idx );
61extern int jw_is_bool_ele( void* st, const char* name, int idx );
62extern int jw_is_null_ele( void* st, const char* name, int idx );
63
64// ---------------- jw_xapi ---------------------------------------------------------------------------------
65extern int jwx_get_bool( void* jblob, char const* field_name, int def_value );
66extern double jwx_get_value( void* jblob, char const* field_name, double def_value );
67extern int jwx_get_ivalue( void* jblob, char const* field_name, int def_value );
68extern char* jwx_get_value_as_str( void* jblob, char const* field_name, char const* def_value, int fmt );
69extern char* jwx_get_str( void* jblob, char const* field_name, char const* def_value );
70
71#endif
72
73#ifdef __cplusplus
74}
75#endif
76