3 ==================================================================================
4 Copyright (c) 2020 Nokia
5 Copyright (c) 2020 AT&T Intellectual Property.
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
11 http://www.apache.org/licenses/LICENSE-2.0
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 ==================================================================================
23 Abstract: This class provides the ability to parse a json string into
24 a hashtable, and exposes various functions that can be used
25 to read the data from the hash.
28 Author: E. Scott Daniels
39 // ------------------------------------------------------------------------
43 void* st; // the resulting symbol table generated by parse
44 void* master_st; // if user switches to a sub-blob; this tracks the original root st
46 Jhash& operator=( const Jhash& soi ); // jhashes cannot be copied because of underlying symbol table goo
47 Jhash( const Jhash& soi );
51 Jhash( const char* jblob ); // builder
52 Jhash( Jhash&& soi ); // mover
53 Jhash& operator=( Jhash&& soi ); // move operator
54 ~Jhash(); // destruction
56 bool Set_blob( const char* name ); // blob/root selection
58 bool Set_blob_ele( const char* name, int eidx ); // set from an array element
63 std::string String( const char* name ); // value fetching
64 double Value( const char* name );
65 bool Bool( const char* name );
67 bool Exists( const char* name ); // presence checking
68 bool Is_missing( const char* name );
70 bool Is_bool( const char* name ); // type checking functions
71 bool Is_null( const char* name );
72 bool Is_string( const char* name );
73 bool Is_value( const char* name );
75 int Array_len( const char* name );
77 bool Is_bool_ele( const char* name, int eidx ); // type of array element checks
78 bool Is_null_ele( const char* name, int eidx );
79 bool Is_string_ele( const char* name, int eidx );
80 bool Is_value_ele( const char* name, int eidx );
82 bool Bool_ele( const char* name, int eidx ); // array oriented sussing functions
83 std::string String_ele( const char* name, int eidx );
84 double Value_ele( const char* name, int eidx );