xref: /netbsd/common/include/prop/prop_array.h (revision d21620b2)
1*d21620b2Sthorpej /*	$NetBSD: prop_array.h,v 1.3 2006/08/21 04:13:28 thorpej Exp $	*/
2774eb1a3Sthorpej 
3774eb1a3Sthorpej /*-
4774eb1a3Sthorpej  * Copyright (c) 2006 The NetBSD Foundation, Inc.
5774eb1a3Sthorpej  * All rights reserved.
6774eb1a3Sthorpej  *
7774eb1a3Sthorpej  * This code is derived from software contributed to The NetBSD Foundation
8774eb1a3Sthorpej  * by Jason R. Thorpe.
9774eb1a3Sthorpej  *
10774eb1a3Sthorpej  * Redistribution and use in source and binary forms, with or without
11774eb1a3Sthorpej  * modification, are permitted provided that the following conditions
12774eb1a3Sthorpej  * are met:
13774eb1a3Sthorpej  * 1. Redistributions of source code must retain the above copyright
14774eb1a3Sthorpej  *    notice, this list of conditions and the following disclaimer.
15774eb1a3Sthorpej  * 2. Redistributions in binary form must reproduce the above copyright
16774eb1a3Sthorpej  *    notice, this list of conditions and the following disclaimer in the
17774eb1a3Sthorpej  *    documentation and/or other materials provided with the distribution.
18774eb1a3Sthorpej  * 3. All advertising materials mentioning features or use of this software
19774eb1a3Sthorpej  *    must display the following acknowledgement:
20774eb1a3Sthorpej  *      This product includes software developed by the NetBSD
21774eb1a3Sthorpej  *      Foundation, Inc. and its contributors.
22774eb1a3Sthorpej  * 4. Neither the name of The NetBSD Foundation nor the names of its
23774eb1a3Sthorpej  *    contributors may be used to endorse or promote products derived
24774eb1a3Sthorpej  *    from this software without specific prior written permission.
25774eb1a3Sthorpej  *
26774eb1a3Sthorpej  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27774eb1a3Sthorpej  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28774eb1a3Sthorpej  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29774eb1a3Sthorpej  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30774eb1a3Sthorpej  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31774eb1a3Sthorpej  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32774eb1a3Sthorpej  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33774eb1a3Sthorpej  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34774eb1a3Sthorpej  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35774eb1a3Sthorpej  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36774eb1a3Sthorpej  * POSSIBILITY OF SUCH DAMAGE.
37774eb1a3Sthorpej  */
38774eb1a3Sthorpej 
39774eb1a3Sthorpej #ifndef _PROPLIB_PROP_ARRAY_H_
40774eb1a3Sthorpej #define	_PROPLIB_PROP_ARRAY_H_
41774eb1a3Sthorpej 
42774eb1a3Sthorpej #include <prop/prop_object.h>
43774eb1a3Sthorpej 
44774eb1a3Sthorpej typedef struct _prop_array *prop_array_t;
45774eb1a3Sthorpej 
46774eb1a3Sthorpej __BEGIN_DECLS
47774eb1a3Sthorpej prop_array_t	prop_array_create(void);
48774eb1a3Sthorpej prop_array_t	prop_array_create_with_capacity(unsigned int);
49774eb1a3Sthorpej 
50774eb1a3Sthorpej prop_array_t	prop_array_copy(prop_array_t);
51774eb1a3Sthorpej prop_array_t	prop_array_copy_mutable(prop_array_t);
52774eb1a3Sthorpej 
53774eb1a3Sthorpej unsigned int	prop_array_capacity(prop_array_t);
54774eb1a3Sthorpej unsigned int	prop_array_count(prop_array_t);
55774eb1a3Sthorpej boolean_t	prop_array_ensure_capacity(prop_array_t, unsigned int);
56774eb1a3Sthorpej 
57774eb1a3Sthorpej void		prop_array_make_immutable(prop_array_t);
58774eb1a3Sthorpej boolean_t	prop_array_mutable(prop_array_t);
59774eb1a3Sthorpej 
60774eb1a3Sthorpej prop_object_iterator_t prop_array_iterator(prop_array_t);
61774eb1a3Sthorpej 
62774eb1a3Sthorpej prop_object_t	prop_array_get(prop_array_t, unsigned int);
63774eb1a3Sthorpej boolean_t	prop_array_set(prop_array_t, unsigned int, prop_object_t);
64774eb1a3Sthorpej boolean_t	prop_array_add(prop_array_t, prop_object_t);
65774eb1a3Sthorpej void		prop_array_remove(prop_array_t, unsigned int);
663e69f1b2Sthorpej 
673e69f1b2Sthorpej boolean_t	prop_array_equals(prop_array_t, prop_array_t);
68*d21620b2Sthorpej 
69*d21620b2Sthorpej char *		prop_array_externalize(prop_array_t);
70*d21620b2Sthorpej prop_array_t	prop_array_internalize(const char *);
71*d21620b2Sthorpej 
72*d21620b2Sthorpej boolean_t	prop_array_externalize_to_file(prop_array_t, const char *);
73*d21620b2Sthorpej prop_array_t	prop_array_internalize_from_file(const char *);
74774eb1a3Sthorpej __END_DECLS
75774eb1a3Sthorpej 
76774eb1a3Sthorpej #endif /* _PROPLIB_PROP_ARRAY_H_ */
77