1 /* $NetBSD: dynstr.h,v 1.3 2014/12/10 04:38:03 christos Exp $ */
4 * Automated Testing Framework (atf)
6 * Copyright (c) 2008 The NetBSD Foundation, Inc.
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
19 * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
20 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 * IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
23 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
25 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
27 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
28 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
29 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 #if !defined(ATF_C_DYNSTR_H)
33 #define ATF_C_DYNSTR_H
39 #include <atf-c/error_fwd.h>
41 /* ---------------------------------------------------------------------
42 * The "atf_dynstr" type.
43 * --------------------------------------------------------------------- */
50 typedef struct atf_dynstr atf_dynstr_t
;
53 extern const size_t atf_dynstr_npos
;
55 /* Constructors and destructors */
56 atf_error_t
atf_dynstr_init(atf_dynstr_t
*);
57 atf_error_t
atf_dynstr_init_ap(atf_dynstr_t
*, const char *, va_list);
58 atf_error_t
atf_dynstr_init_fmt(atf_dynstr_t
*, const char *, ...);
59 atf_error_t
atf_dynstr_init_raw(atf_dynstr_t
*, const void *, size_t);
60 atf_error_t
atf_dynstr_init_rep(atf_dynstr_t
*, size_t, char);
61 atf_error_t
atf_dynstr_init_substr(atf_dynstr_t
*, const atf_dynstr_t
*,
63 atf_error_t
atf_dynstr_copy(atf_dynstr_t
*, const atf_dynstr_t
*);
64 void atf_dynstr_fini(atf_dynstr_t
*);
65 char *atf_dynstr_fini_disown(atf_dynstr_t
*);
68 const char *atf_dynstr_cstring(const atf_dynstr_t
*);
69 size_t atf_dynstr_length(const atf_dynstr_t
*);
70 size_t atf_dynstr_rfind_ch(const atf_dynstr_t
*, char);
73 atf_error_t
atf_dynstr_append_ap(atf_dynstr_t
*, const char *, va_list);
74 atf_error_t
atf_dynstr_append_fmt(atf_dynstr_t
*, const char *, ...);
75 void atf_dynstr_clear(atf_dynstr_t
*);
76 atf_error_t
atf_dynstr_prepend_ap(atf_dynstr_t
*, const char *, va_list);
77 atf_error_t
atf_dynstr_prepend_fmt(atf_dynstr_t
*, const char *, ...);
80 bool atf_equal_dynstr_cstring(const atf_dynstr_t
*, const char *);
81 bool atf_equal_dynstr_dynstr(const atf_dynstr_t
*, const atf_dynstr_t
*);
83 #endif /* ATF_C_DYNSTR_H */