E. Scott Daniels | 97204c8 | 2020-06-29 15:39:57 -0400 | [diff] [blame] | 1 | // 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 |
| 31 | extern "C" { |
| 32 | #endif |
| 33 | |
| 34 | #ifndef _JWRAPPER_H |
| 35 | #define _JWRAPPER_H |
| 36 | |
| 37 | |
| 38 | //---------------- jwrapper ------------------------------------------------------------------------------- |
| 39 | extern void jw_nuke( void* st ); |
| 40 | extern void* jw_new( const char* json ); |
| 41 | |
| 42 | extern int jw_bool_ele( void* st, const char* name, int idx ); |
| 43 | extern void jw_dump( void* st ); |
| 44 | extern int jw_missing( void* st, const char* name ); |
| 45 | extern int jw_exists( void* st, const char* name ); |
| 46 | extern char* jw_string( void* st, const char* name ); |
| 47 | extern double jw_value( void* st, const char* name ); |
| 48 | extern void* jw_blob( void* st, const char* name ); |
| 49 | extern char* jw_string_ele( void* st, const char* name, int idx ); |
| 50 | extern double jw_value_ele( void* st, const char* name, int idx ); |
| 51 | extern void* jw_obj_ele( void* st, const char* name, int idx ); |
| 52 | extern int jw_array_len( void* st, const char* name ); |
| 53 | |
| 54 | extern int jw_is_string( void* st, const char* name ); |
| 55 | extern int jw_is_value( void* st, const char* name ); |
| 56 | extern int jw_is_bool( void* st, const char* name ); |
| 57 | extern int jw_is_null( void* st, const char* name ); |
| 58 | |
| 59 | extern int jw_is_string_ele( void* st, const char* name, int idx ); |
| 60 | extern int jw_is_value_ele( void* st, const char* name, int idx ); |
| 61 | extern int jw_is_bool_ele( void* st, const char* name, int idx ); |
| 62 | extern int jw_is_null_ele( void* st, const char* name, int idx ); |
| 63 | |
| 64 | // ---------------- jw_xapi --------------------------------------------------------------------------------- |
| 65 | extern int jwx_get_bool( void* jblob, char const* field_name, int def_value ); |
| 66 | extern double jwx_get_value( void* jblob, char const* field_name, double def_value ); |
| 67 | extern int jwx_get_ivalue( void* jblob, char const* field_name, int def_value ); |
| 68 | extern char* jwx_get_value_as_str( void* jblob, char const* field_name, char const* def_value, int fmt ); |
| 69 | extern 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 | |