Initial import of binutils 2.22 on the new vendor branch
[dragonfly.git] / lib / libprop / prop_dictionary_util.3
1 .\"     $NetBSD: prop_dictionary_util.3,v 1.7 2011/08/07 11:33:03 jmcneill Exp $
2 .\"
3 .\" Copyright (c) 2006 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
5 .\"
6 .\" This code is derived from software contributed to The NetBSD Foundation
7 .\" by Jason R. Thorpe.
8 .\"
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
11 .\" are met:
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.
17 .\"
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.
29 .\"
30 .Dd August 7, 2011
31 .Dt PROP_DICTIONARY_UTIL 3
32 .Os
33 .Sh NAME
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 .Sh LIBRARY
60 .Lb libprop
61 .Sh SYNOPSIS
62 .In libprop/proplib.h
63 .\"
64 .Ft bool
65 .Fn prop_dictionary_get_dict "prop_dictionary_t dict" "const char *key" \
66     "prop_dictionary_t *dictp"
67 .Ft bool
68 .Fn prop_dictionary_get_bool "prop_dictionary_t dict" "const char *key" \
69     "bool *valp"
70 .Ft bool
71 .Fn prop_dictionary_set_bool "prop_dictionary_t dict" "const char *key" \
72     "bool val"
73 .\"
74 .Ft bool
75 .Fn prop_dictionary_get_int8 "prop_dictionary_t dict" "const char *key" \
76     "int8_t *valp"
77 .Ft bool
78 .Fn prop_dictionary_get_uint8 "prop_dictionary_t dict" "const char *key" \
79     "uint8_t *valp"
80 .Ft bool
81 .Fn prop_dictionary_set_int8 "prop_dictionary_t dict" "const char *key" \
82     "int8_t val"
83 .Ft bool
84 .Fn prop_dictionary_set_uint8 "prop_dictionary_t dict" "const char *key" \
85     "uint8_t val"
86 .\"
87 .Ft bool
88 .Fn prop_dictionary_get_int16 "prop_dictionary_t dict" "const char *key" \
89     "int16_t *valp"
90 .Ft bool
91 .Fn prop_dictionary_get_uint16 "prop_dictionary_t dict" "const char *key" \
92     "uint16_t *valp"
93 .Ft bool
94 .Fn prop_dictionary_set_int16 "prop_dictionary_t dict" "const char *key" \
95     "int16_t val"
96 .Ft bool
97 .Fn prop_dictionary_set_uint16 "prop_dictionary_t dict" "const char *key" \
98     "uint16_t val"
99 .\"
100 .Ft bool
101 .Fn prop_dictionary_get_int32 "prop_dictionary_t dict" "const char *key" \
102     "int32_t *valp"
103 .Ft bool
104 .Fn prop_dictionary_get_uint32 "prop_dictionary_t dict" "const char *key" \
105     "uint32_t *valp"
106 .Ft bool
107 .Fn prop_dictionary_set_int32 "prop_dictionary_t dict" "const char *key" \
108     "int32_t val"
109 .Ft bool
110 .Fn prop_dictionary_set_uint32 "prop_dictionary_t dict" "const char *key" \
111     "uint32_t val"
112 .\"
113 .Ft bool
114 .Fn prop_dictionary_get_int64 "prop_dictionary_t dict" "const char *key" \
115     "int64_t *valp"
116 .Ft bool
117 .Fn prop_dictionary_get_uint64 "prop_dictionary_t dict" "const char *key" \
118     "uint64_t *valp"
119 .Ft bool
120 .Fn prop_dictionary_set_int64 "prop_dictionary_t dict" "const char *key" \
121     "int64_t val"
122 .Ft bool
123 .Fn prop_dictionary_set_uint64 "prop_dictionary_t dict" "const char *key" \
124     "uint64_t val"
125 .\"
126 .Ft bool
127 .Fn prop_dictionary_get_cstring "prop_dictionary_t dict" "const char *key" \
128     "char **strp"
129 .Ft bool
130 .Fn prop_dictionary_set_cstring "prop_dictionary_t dict" "const char *key" \
131     "const char *str"
132 .\"
133 .Ft bool
134 .Fn prop_dictionary_get_cstring_nocopy "prop_dictionary_t dict" \
135     "const char *key" "const char **strp"
136 .Ft bool
137 .Fn prop_dictionary_set_cstring_nocopy "prop_dictionary_t dict" \
138     "const char *key" "const char *strp"
139 .Ft bool
140 .Fn prop_dictionary_set_and_rel "prop_dictionary_t dict" \
141     "const char *key" "prop_object_t obj"
142 .Sh DESCRIPTION
143 The
144 .Nm prop_dictionary_util
145 family of functions are provided to make getting and setting values in
146 dictionaries more convenient in some applications.
147 .Pp
148 The getters check the type of the returned object and, in some cases, also
149 ensure that the returned value is within the range implied by the getter's
150 value type.
151 .Pp
152 The setters handle object creation and release for the caller.
153 .Pp
154 The
155 .Fn prop_dictionary_get_cstring
156 function returns dynamically allocated memory.
157 See
158 .Xr prop_string 3
159 for more information.
160 .Pp
161 The
162 .Fn prop_dictionary_get_cstring_nocopy
163 and
164 .Fn prop_dictionary_set_cstring_nocopy
165 functions do not copy the string that is set or returned.
166 See
167 .Xr prop_string 3
168 for more information.
169 .Pp
170 The
171 .Fn prop_dictionary_set_and_rel
172 function adds the object to the dictionary and releases it.
173 The object is also released on failure.
174 .Sh RETURN VALUES
175 The
176 .Nm prop_dictionary_util
177 getter functions return
178 .Dv true
179 if the object exists in the dictionary and the value is in-range, or
180 .Dv false
181 otherwise.
182 .Pp
183 The
184 .Nm prop_dictionary_util
185 setter functions return
186 .Dv true
187 if creating the object and storing it in the dictionary is successful, or
188 .Dv false
189 otherwise.
190 .Sh SEE ALSO
191 .Xr prop_bool 3 ,
192 .Xr prop_dictionary 3 ,
193 .Xr prop_number 3 ,
194 .Xr proplib 3
195 .Sh HISTORY
196 The
197 .Nm proplib
198 property container object library first appeared in
199 .Nx 4.0 .