• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  *
3  *  Copyright (C) 2015 Google, Inc.
4  *
5  *  Licensed under the Apache License, Version 2.0 (the "License");
6  *  you may not use this file except in compliance with the License.
7  *  You may obtain a copy of the License at:
8  *
9  *  http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *  Unless required by applicable law or agreed to in writing, software
12  *  distributed under the License is distributed on an "AS IS" BASIS,
13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *  See the License for the specific language governing permissions and
15  *  limitations under the License.
16  *
17  ******************************************************************************/
18 
19 #pragma once
20 
21 #include "osi/include/hash_map.h"
22 
23 // Creates a hash map based on the |params| string containing key and value
24 // pairs.  Pairs are expected in the form "key=value" separated by the ';'
25 // character.  Both ';' and '=' characters are invalid in keys or values.
26 // |params| cannot be NULL, is not modified and is owned by the caller.
27 // Examples:
28 //   "key0=value10;key1=value1;" -> map: [key0]="value0" [key1]="value1"
29 //   "key0=;key1=value1;"        -> map: [key0]="" [key1]="value1"
30 //   "=value0;key1=value1;"      -> map: [key1]="value1"
31 // A new hash map or NULL is returned and is owned by the caller.
32 hash_map_t *hash_map_utils_new_from_string_params(const char *params);
33 
34 // Dumps the contents of the hash_map to the log for debugging purposes.
35 // If |map| is not NULL, all entries of |map| will be dumped, otherwise nothing
36 // will be dumped. Note that this function does not take the ownership of |map|.
37 void hash_map_utils_dump_string_keys_string_values(hash_map_t *map);
38