1 .\" $NetBSD: prop_dictionary_util.3,v 1.8 2011/10/17 09:24:54 wiz Exp $
3 .\" Copyright (c) 2006 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
6 .\" This code is derived from software contributed to The NetBSD Foundation
7 .\" by Jason R. Thorpe.
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in the
16 .\" documentation and/or other materials provided with the distribution.
18 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 .\" POSSIBILITY OF SUCH DAMAGE.
31 .Dt PROP_DICTIONARY_UTIL 3
34 .Nm prop_dictionary_util ,
35 .Nm prop_dictionary_get_dict ,
36 .Nm prop_dictionary_get_bool ,
37 .Nm prop_dictionary_set_bool ,
38 .Nm prop_dictionary_get_int8 ,
39 .Nm prop_dictionary_get_uint8 ,
40 .Nm prop_dictionary_set_int8 ,
41 .Nm prop_dictionary_set_uint8 ,
42 .Nm prop_dictionary_get_int16 ,
43 .Nm prop_dictionary_get_uint16 ,
44 .Nm prop_dictionary_set_int16 ,
45 .Nm prop_dictionary_set_uint16 ,
46 .Nm prop_dictionary_get_int32 ,
47 .Nm prop_dictionary_get_uint32 ,
48 .Nm prop_dictionary_set_int32 ,
49 .Nm prop_dictionary_set_uint32 ,
50 .Nm prop_dictionary_get_int64 ,
51 .Nm prop_dictionary_get_uint64 ,
52 .Nm prop_dictionary_set_int64 ,
53 .Nm prop_dictionary_set_uint64 ,
54 .Nm prop_dictionary_get_cstring ,
55 .Nm prop_dictionary_set_cstring ,
56 .Nm prop_dictionary_get_cstring_nocopy ,
57 .Nm prop_dictionary_set_cstring_nocopy ,
58 .Nm prop_dictionary_set_and_rel
59 .Nd dictionary property collection object utility functions
66 .Fn prop_dictionary_get_dict "prop_dictionary_t dict" "const char *key" \
67 "prop_dictionary_t *dictp"
69 .Fn prop_dictionary_get_bool "prop_dictionary_t dict" "const char *key" \
72 .Fn prop_dictionary_set_bool "prop_dictionary_t dict" "const char *key" \
76 .Fn prop_dictionary_get_int8 "prop_dictionary_t dict" "const char *key" \
79 .Fn prop_dictionary_get_uint8 "prop_dictionary_t dict" "const char *key" \
82 .Fn prop_dictionary_set_int8 "prop_dictionary_t dict" "const char *key" \
85 .Fn prop_dictionary_set_uint8 "prop_dictionary_t dict" "const char *key" \
89 .Fn prop_dictionary_get_int16 "prop_dictionary_t dict" "const char *key" \
92 .Fn prop_dictionary_get_uint16 "prop_dictionary_t dict" "const char *key" \
95 .Fn prop_dictionary_set_int16 "prop_dictionary_t dict" "const char *key" \
98 .Fn prop_dictionary_set_uint16 "prop_dictionary_t dict" "const char *key" \
102 .Fn prop_dictionary_get_int32 "prop_dictionary_t dict" "const char *key" \
105 .Fn prop_dictionary_get_uint32 "prop_dictionary_t dict" "const char *key" \
108 .Fn prop_dictionary_set_int32 "prop_dictionary_t dict" "const char *key" \
111 .Fn prop_dictionary_set_uint32 "prop_dictionary_t dict" "const char *key" \
115 .Fn prop_dictionary_get_int64 "prop_dictionary_t dict" "const char *key" \
118 .Fn prop_dictionary_get_uint64 "prop_dictionary_t dict" "const char *key" \
121 .Fn prop_dictionary_set_int64 "prop_dictionary_t dict" "const char *key" \
124 .Fn prop_dictionary_set_uint64 "prop_dictionary_t dict" "const char *key" \
128 .Fn prop_dictionary_get_cstring "prop_dictionary_t dict" "const char *key" \
131 .Fn prop_dictionary_set_cstring "prop_dictionary_t dict" "const char *key" \
135 .Fn prop_dictionary_get_cstring_nocopy "prop_dictionary_t dict" \
136 "const char *key" "const char **strp"
138 .Fn prop_dictionary_set_cstring_nocopy "prop_dictionary_t dict" \
139 "const char *key" "const char *strp"
141 .Fn prop_dictionary_set_and_rel "prop_dictionary_t dict" \
142 "const char *key" "prop_object_t obj"
145 .Nm prop_dictionary_util
146 family of functions are provided to make getting and setting values in
147 dictionaries more convenient in some applications.
149 The getters check the type of the returned object and, in some cases, also
150 ensure that the returned value is within the range implied by the getter's
153 The setters handle object creation and release for the caller.
156 .Fn prop_dictionary_get_cstring
157 function returns dynamically allocated memory.
160 for more information.
163 .Fn prop_dictionary_get_cstring_nocopy
165 .Fn prop_dictionary_set_cstring_nocopy
166 functions do not copy the string that is set or returned.
169 for more information.
172 .Fn prop_dictionary_set_and_rel
173 function adds the object to the dictionary and releases it.
174 The object is also released on failure.
177 .Nm prop_dictionary_util
178 getter functions return
180 if the object exists in the dictionary and the value is in-range, or
185 .Nm prop_dictionary_util
186 setter functions return
188 if creating the object and storing it in the dictionary is successful, or
193 .Xr prop_dictionary 3 ,
199 property container object library first appeared in