Merge branch 'vendor/AWK'
[dragonfly.git] / lib / libprop / prop_dictionary_util.3
1 .\"     $NetBSD: prop_dictionary_util.3,v 1.4 2008/06/02 09:27:04 haad 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 October 25, 2006
31 .Dt PROP_DICTIONARY_UTIL 3
32 .Os
33 .Sh NAME
34 .Nm prop_dictionary_util ,
35 .Nm prop_dictionary_get_bool ,
36 .Nm prop_dictionary_set_bool ,
37 .Nm prop_dictionary_get_int8 ,
38 .Nm prop_dictionary_get_uint8 ,
39 .Nm prop_dictionary_set_int8 ,
40 .Nm prop_dictionary_set_uint8 ,
41 .Nm prop_dictionary_get_int16 ,
42 .Nm prop_dictionary_get_uint16 ,
43 .Nm prop_dictionary_set_int16 ,
44 .Nm prop_dictionary_set_uint16 ,
45 .Nm prop_dictionary_get_int32 ,
46 .Nm prop_dictionary_get_uint32 ,
47 .Nm prop_dictionary_set_int32 ,
48 .Nm prop_dictionary_set_uint32 ,
49 .Nm prop_dictionary_get_int64 ,
50 .Nm prop_dictionary_get_uint64 ,
51 .Nm prop_dictionary_set_int64 ,
52 .Nm prop_dictionary_set_uint64 ,
53 .Nm prop_dictionary_get_cstring ,
54 .Nm prop_dictionary_set_cstring ,
55 .Nm prop_dictionary_get_cstring_nocopy ,
56 .Nm prop_dictionary_set_cstring_nocopy
57 .Nd dictionary property collection object utility functions
58 .Sh LIBRARY
59 .Lb libprop
60 .Sh SYNOPSIS
61 .In libprop/proplib.h
62 .\"
63 .Ft bool
64 .Fn prop_dictionary_get_bool "prop_dictionary_t dict" "const char *key" \
65     "bool *valp"
66 .Ft bool
67 .Fn prop_dictionary_set_bool "prop_dictionary_t dict" "const char *key" \
68     "bool val"
69 .\"
70 .Ft bool
71 .Fn prop_dictionary_get_int8 "prop_dictionary_t dict" "const char *key" \
72     "int8_t *valp"
73 .Ft bool
74 .Fn prop_dictionary_get_uint8 "prop_dictionary_t dict" "const char *key" \
75     "uint8_t *valp"
76 .Ft bool
77 .Fn prop_dictionary_set_int8 "prop_dictionary_t dict" "const char *key" \
78     "int8_t val"
79 .Ft bool
80 .Fn prop_dictionary_set_uint8 "prop_dictionary_t dict" "const char *key" \
81     "uint8_t val"
82 .\"
83 .Ft bool
84 .Fn prop_dictionary_get_int16 "prop_dictionary_t dict" "const char *key" \
85     "int16_t *valp"
86 .Ft bool
87 .Fn prop_dictionary_get_uint16 "prop_dictionary_t dict" "const char *key" \
88     "uint16_t *valp"
89 .Ft bool
90 .Fn prop_dictionary_set_int16 "prop_dictionary_t dict" "const char *key" \
91     "int16_t val"
92 .Ft bool
93 .Fn prop_dictionary_set_uint16 "prop_dictionary_t dict" "const char *key" \
94     "uint16_t val"
95 .\"
96 .Ft bool
97 .Fn prop_dictionary_get_int32 "prop_dictionary_t dict" "const char *key" \
98     "int32_t *valp"
99 .Ft bool
100 .Fn prop_dictionary_get_uint32 "prop_dictionary_t dict" "const char *key" \
101     "uint32_t *valp"
102 .Ft bool
103 .Fn prop_dictionary_set_int32 "prop_dictionary_t dict" "const char *key" \
104     "int32_t val"
105 .Ft bool
106 .Fn prop_dictionary_set_uint32 "prop_dictionary_t dict" "const char *key" \
107     "uint32_t val"
108 .\"
109 .Ft bool
110 .Fn prop_dictionary_get_int64 "prop_dictionary_t dict" "const char *key" \
111     "int64_t *valp"
112 .Ft bool
113 .Fn prop_dictionary_get_uint64 "prop_dictionary_t dict" "const char *key" \
114     "uint64_t *valp"
115 .Ft bool
116 .Fn prop_dictionary_set_int64 "prop_dictionary_t dict" "const char *key" \
117     "int64_t val"
118 .Ft bool
119 .Fn prop_dictionary_set_uint64 "prop_dictionary_t dict" "const char *key" \
120     "uint64_t val"
121 .\"
122 .Ft bool
123 .Fn prop_dictionary_get_cstring "prop_dictionary_t dict" "const char *key" \
124     "char **strp"
125 .Ft bool
126 .Fn prop_dictionary_set_cstring "prop_dictionary_t dict" "const char *key" \
127     "const char *str"
128 .\"
129 .Ft bool
130 .Fn prop_dictionary_get_cstring_nocopy "prop_dictionary_t dict" \
131     "const char *key" "const char **strp"
132 .Ft bool
133 .Fn prop_dictionary_set_cstring_nocopy "prop_dictionary_t dict" \
134     "const char *key" "const char *strp"
135 .Sh DESCRIPTION
136 The
137 .Nm prop_dictionary_util
138 family of functions are provided to make getting and setting values in
139 dictionaries more convenient in some applications.
140 .Pp
141 The getters check the type of the returned object and, in some cases, also
142 ensure that the returned value is within the range implied by the getter's
143 value type.
144 .Pp
145 The setters handle object creation and release for the caller.
146 .Pp
147 The
148 .Fn prop_dictionary_get_cstring
149 function returns dynamically allocated memory.
150 See
151 .Xr prop_string 3
152 for more information.
153 .Pp
154 The
155 .Fn prop_dictionary_get_cstring_nocopy
156 and
157 .Fn prop_dictionary_set_cstring_nocopy
158 functions do not copy the string that is set or returned.
159 See
160 .Xr prop_string 3
161 for more information.
162 .Sh RETURN VALUES
163 The
164 .Nm prop_dictionary_util
165 getter functions return
166 .Dv true
167 if the object exists in the dictionary and the value is in-range, or
168 .Dv false
169 otherwise.
170 .Pp
171 The
172 .Nm prop_dictionary_util
173 setter functions return
174 .Dv true
175 if creating the object and storing it in the dictionary is successful, or
176 .Dv false
177 otherwise.
178 .Sh SEE ALSO
179 .Xr prop_bool 3 ,
180 .Xr prop_dictionary 3 ,
181 .Xr prop_number 3 ,
182 .Xr proplib 3
183 .Sh HISTORY
184 The
185 .Nm proplib
186 property container object library first appeared in
187 .Nx 4.0 .