No empty .Rs/.Re
[netbsd-mini2440.git] / common / lib / libprop / prop_dictionary_util.3
bloba5345ea18a10bf0fc8e0895e7630e8825610bea2
1 .\"     $NetBSD: prop_dictionary_util.3,v 1.3 2008/04/30 13:10:46 martin 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 .Sh LIBRARY
58 .Lb libprop
59 .Sh SYNOPSIS
60 .In prop/proplib.h
61 .\"
62 .Ft bool
63 .Fn prop_dictionary_get_bool "prop_dictionary_t dict" "const char *key" \
64     "bool *valp"
65 .Ft bool
66 .Fn prop_dictionary_set_bool "prop_dictionary_t dict" "const char *key" \
67     "bool val"
68 .\"
69 .Ft bool
70 .Fn prop_dictionary_get_int8 "prop_dictionary_t dict" "const char *key" \
71     "int8_t *valp"
72 .Ft bool
73 .Fn prop_dictionary_get_uint8 "prop_dictionary_t dict" "const char *key" \
74     "uint8_t *valp"
75 .Ft bool
76 .Fn prop_dictionary_set_int8 "prop_dictionary_t dict" "const char *key" \
77     "int8_t val"
78 .Ft bool
79 .Fn prop_dictionary_set_uint8 "prop_dictionary_t dict" "const char *key" \
80     "uint8_t val"
81 .\"
82 .Ft bool
83 .Fn prop_dictionary_get_int16 "prop_dictionary_t dict" "const char *key" \
84     "int16_t *valp"
85 .Ft bool
86 .Fn prop_dictionary_get_uint16 "prop_dictionary_t dict" "const char *key" \
87     "uint16_t *valp"
88 .Ft bool
89 .Fn prop_dictionary_set_int16 "prop_dictionary_t dict" "const char *key" \
90     "int16_t val"
91 .Ft bool
92 .Fn prop_dictionary_set_uint16 "prop_dictionary_t dict" "const char *key" \
93     "uint16_t val"
94 .\"
95 .Ft bool
96 .Fn prop_dictionary_get_int32 "prop_dictionary_t dict" "const char *key" \
97     "int32_t *valp"
98 .Ft bool
99 .Fn prop_dictionary_get_uint32 "prop_dictionary_t dict" "const char *key" \
100     "uint32_t *valp"
101 .Ft bool
102 .Fn prop_dictionary_set_int32 "prop_dictionary_t dict" "const char *key" \
103     "int32_t val"
104 .Ft bool
105 .Fn prop_dictionary_set_uint32 "prop_dictionary_t dict" "const char *key" \
106     "uint32_t val"
108 .Ft bool
109 .Fn prop_dictionary_get_int64 "prop_dictionary_t dict" "const char *key" \
110     "int64_t *valp"
111 .Ft bool
112 .Fn prop_dictionary_get_uint64 "prop_dictionary_t dict" "const char *key" \
113     "uint64_t *valp"
114 .Ft bool
115 .Fn prop_dictionary_set_int64 "prop_dictionary_t dict" "const char *key" \
116     "int64_t val"
117 .Ft bool
118 .Fn prop_dictionary_set_uint64 "prop_dictionary_t dict" "const char *key" \
119     "uint64_t val"
121 .Ft bool
122 .Fn prop_dictionary_get_cstring "prop_dictionary_t dict" "const char *key" \
123     "char **strp"
124 .Ft bool
125 .Fn prop_dictionary_set_cstring "prop_dictionary_t dict" "const char *key" \
126     "const char *str"
128 .Ft bool
129 .Fn prop_dictionary_get_cstring_nocopy "prop_dictionary_t dict" \
130     "const char *key" "const char **strp"
131 .Ft bool
132 .Fn prop_dictionary_set_cstring_nocopy "prop_dictionary_t dict" \
133     "const char *key" "const char *strp"
134 .Sh DESCRIPTION
136 .Nm prop_dictionary_util
137 family of functions are provided to make getting and setting values in
138 dictionaries more convenient in some applications.
140 The getters check the type of the returned object and, in some cases, also
141 ensure that the returned value is within the range implied by the getter's
142 value type.
144 The setters handle object creation and release for the caller.
147 .Fn prop_dictionary_get_cstring
148 function returns dynamically allocated memory.
150 .Xr prop_string 3
151 for more information.
154 .Fn prop_dictionary_get_cstring_nocopy
156 .Fn prop_dictionary_set_cstring_nocopy
157 functions do not copy the string that is set or returned.
159 .Xr prop_string 3
160 for more information.
161 .Sh RETURN VALUES
163 .Nm prop_dictionary_util
164 getter functions return
165 .Dv true
166 if the object exists in the dictionary and the value is in-range, or
167 .Dv false
168 otherwise.
171 .Nm prop_dictionary_util
172 setter functions return
173 .Dv true
174 if creating the object and storing it in the dictionary is successful, or
175 .Dv false
176 otherwise.
177 .Sh SEE ALSO
178 .Xr prop_bool 3 ,
179 .Xr prop_dictionary 3 ,
180 .Xr prop_number 3 ,
181 .Xr proplib 3
182 .Sh HISTORY
184 .Nm proplib
185 property container object library first appeared in
186 .Nx 4.0 .