1 .\" $NetBSD: prop_string.3,v 1.7 2009/12/14 06:06:22 dholland 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.
35 .Nm prop_string_create ,
36 .Nm prop_string_create_cstring ,
37 .Nm prop_string_create_cstring_nocopy ,
38 .Nm prop_string_copy ,
39 .Nm prop_string_copy_mutable ,
40 .Nm prop_string_size ,
41 .Nm prop_string_mutable ,
42 .Nm prop_string_cstring ,
43 .Nm prop_string_cstring_nocopy ,
44 .Nm prop_string_append ,
45 .Nm prop_string_append_cstring ,
46 .Nm prop_string_equals ,
47 .Nm prop_string_equals_cstring
48 .Nd string value property object
55 .Fn prop_string_create "void"
57 .Fn prop_string_create_cstring "const char *cstring"
59 .Fn prop_string_create_cstring_nocopy "const char *cstring"
62 .Fn prop_string_copy "prop_string_t string"
64 .Fn prop_string_copy_mutable "prop_string_t string"
67 .Fn prop_string_size "prop_string_t string"
69 .Fn prop_string_mutable "prop_string_t string"
72 .Fn prop_string_cstring "prop_string_t string"
74 .Fn prop_string_cstring_nocopy "prop_string_t string"
77 .Fn prop_string_append "prop_string_t str1" "prop_string_t str2"
79 .Fn prop_string_append_cstring "prop_string_t string" "const char *cstring"
82 .Fn prop_string_equals "prop_string_t str1" "prop_string_t str2"
84 .Fn prop_string_equals_cstring "prop_string_t string" "const char *cstring"
88 family of functions operate on a string value property object type.
89 .Bl -tag -width "xxxxx"
90 .It Fn prop_string_create "void"
91 Create an empty mutable string.
95 .It Fn prop_string_create_cstring "const char *cstring"
96 Create a mutable string that contains a copy of
101 .It Fn prop_string_create_cstring_nocopy "const char *cstring"
102 Create an immutable string that contains a reference to
107 .It Fn prop_string_copy "prop_string_t string"
109 If the string being copied is an immutable external C string reference,
110 then the copy is also immutable and references the same external C string.
114 .It Fn prop_string_copy_mutable "prop_string_t string"
115 Copy a string, always creating a mutable copy.
119 .It Fn prop_string_size "prop_string_t string"
120 Returns the size of the string, not including the terminating NUL.
121 If the supplied object isn't a string, zero is returned.
122 .It Fn prop_string_mutable "prop_string_t string"
125 if the string is mutable.
126 If the supplied object isn't a string,
129 .It Fn prop_string_cstring "prop_string_t string"
130 Returns a copy of the string's contents as a C string.
131 The caller is responsible for freeing the returned buffer.
133 In user space, the buffer is allocated using
135 In the kernel, the buffer is allocated using
137 using the malloc type
143 .It Fn prop_string_cstring_nocopy "prop_string_t string"
144 Returns an immutable reference to the contents of the string as a
146 If the supplied object isn't a string,
149 .It Fn prop_string_append "prop_string_t str1" "prop_string_t str2"
150 Append the contents of
154 which must be mutable.
160 .It Fn prop_string_append_cstring "prop_string_t string" "const char *cstring"
165 which must be mutable.
171 .It Fn prop_string_equals "prop_string_t str1" "prop_string_t str2"
174 if the two string objects are equivalent.
175 .It Fn prop_string_equals_cstring "prop_string_t string" "const char *cstring"
178 if the string's value is equivalent to
185 .Xr prop_dictionary 3 ,
192 property container object library first appeared in