2 * Automated Testing Framework (atf)
4 * Copyright (c) 2008 The NetBSD Foundation, Inc.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
17 * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
18 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
23 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
25 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
27 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 #if !defined(ATF_C_DYNSTR_H)
31 #define ATF_C_DYNSTR_H
35 #include <atf-c/error_fwd.h>
36 #include <atf-c/object.h>
38 /* ---------------------------------------------------------------------
39 * The "atf_dynstr" type.
40 * --------------------------------------------------------------------- */
43 atf_object_t m_object
;
49 typedef struct atf_dynstr atf_dynstr_t
;
52 extern const size_t atf_dynstr_npos
;
54 /* Constructors and destructors */
55 atf_error_t
atf_dynstr_init(atf_dynstr_t
*);
56 atf_error_t
atf_dynstr_init_ap(atf_dynstr_t
*, const char *, va_list);
57 atf_error_t
atf_dynstr_init_fmt(atf_dynstr_t
*, const char *, ...);
58 atf_error_t
atf_dynstr_init_raw(atf_dynstr_t
*, const void *, size_t);
59 atf_error_t
atf_dynstr_init_rep(atf_dynstr_t
*, size_t, char);
60 atf_error_t
atf_dynstr_init_substr(atf_dynstr_t
*, const atf_dynstr_t
*,
62 atf_error_t
atf_dynstr_copy(atf_dynstr_t
*, const atf_dynstr_t
*);
63 void atf_dynstr_fini(atf_dynstr_t
*);
64 char *atf_dynstr_fini_disown(atf_dynstr_t
*);
67 const char *atf_dynstr_cstring(const atf_dynstr_t
*);
68 size_t atf_dynstr_length(const atf_dynstr_t
*);
69 size_t atf_dynstr_rfind_ch(const atf_dynstr_t
*, char);
72 atf_error_t
atf_dynstr_append_ap(atf_dynstr_t
*, const char *, va_list);
73 atf_error_t
atf_dynstr_append_fmt(atf_dynstr_t
*, const char *, ...);
74 void atf_dynstr_clear(atf_dynstr_t
*);
75 atf_error_t
atf_dynstr_prepend_ap(atf_dynstr_t
*, const char *, va_list);
76 atf_error_t
atf_dynstr_prepend_fmt(atf_dynstr_t
*, const char *, ...);
79 bool atf_equal_dynstr_cstring(const atf_dynstr_t
*, const char *);
80 bool atf_equal_dynstr_dynstr(const atf_dynstr_t
*, const atf_dynstr_t
*);
82 #endif /* ATF_C_DYNSTR_H */