1 .\" $NetBSD: prop_string.3,v 1.6 2008/04/30 13:10:46 martin 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_cstring "prop_string_t string"
69 .Fn prop_string_cstring_nocopy "prop_string_t string"
72 .Fn prop_string_append "prop_string_t str1" "prop_string_t str2"
74 .Fn prop_string_append_cstring "prop_string_t string" "const char *cstring"
77 .Fn prop_string_equals "prop_string_t str1" "prop_string_t str2"
79 .Fn prop_string_equals_cstring "prop_string_t string" "const char *cstring"
83 family of functions operate on a string value property object type.
84 .Bl -tag -width "xxxxx"
85 .It Fn prop_string_create "void"
86 Create an empty mutable string.
90 .It Fn prop_string_create_cstring "const char *cstring"
91 Create a mutable string that contains a copy of
96 .It Fn prop_string_create_cstring_nocopy "const char *cstring"
97 Create an immutable string that contains a reference to
102 .It Fn prop_string_copy "prop_string_t string"
104 If the the string being copied is an immutable external C string reference,
105 then the copy is also immutable and references the same external C string.
109 .It Fn prop_string_copy_mutable "prop_string_t string"
110 Copy a string, always creating a mutable copy.
114 .It Fn prop_string_size "prop_string_t string"
115 Returns the size of the string, not including the terminating NUL.
116 If the supplied object isn't a string, zero is returned.
117 .It Fn prop_string_mutable "prop_string_t string"
120 if the string is mutable.
121 If the supplied object isn't a string,
124 .It Fn prop_string_cstring "prop_string_t string"
125 Returns a copy of the string's contents as a C string.
126 The caller is responsible for freeing the returned buffer.
128 In user space, the buffer is allocated using
130 In the kernel, the buffer is allocated using
132 using the malloc type
138 .It Fn prop_string_cstring_nocopy "prop_string_t string"
139 Returns an immutable reference to the contents of the string as a
141 If the supplied object isn't a string,
144 .It Fn prop_string_append "prop_string_t str1" "prop_string_t str2"
145 Append the contents of
149 which must be mutable.
155 .It Fn prop_string_append_cstring "prop_string_t string" "const char *cstring"
160 which must be mutable.
166 .It Fn prop_string_equals "prop_string_t str1" "prop_string_t str2"
169 if the two string objects are equivalent.
170 .It Fn prop_string_equals_cstring "prop_string_t string" "const char *cstring"
173 if the string's value is equivalent to
180 .Xr prop_dictionary 3 ,
187 property container object library first appeared in