1 /* -*- mode: C; c-file-style: "gnu" -*- */
2 /* dbus-string.h String utility class (internal to D-BUS implementation)
4 * Copyright (C) 2002 Red Hat, Inc.
6 * Licensed under the Academic Free License version 1.2
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 #include <dbus/dbus-memory.h>
30 #include <dbus/dbus-types.h>
34 typedef struct DBusString DBusString;
38 void *dummy1; /**< placeholder */
39 int dummy2; /**< placeholder */
40 int dummy3; /**< placeholder */
41 int dummy4; /**< placeholder */
42 unsigned int dummy5 : 1; /**< placeholder */
43 unsigned int dummy6 : 1; /**< placeholder */
44 unsigned int dummy7 : 1; /**< placeholder */
45 unsigned int dummy8 : 3; /**< placeholder */
48 dbus_bool_t _dbus_string_init (DBusString *str);
49 void _dbus_string_init_const (DBusString *str,
51 void _dbus_string_init_const_len (DBusString *str,
54 dbus_bool_t _dbus_string_init_preallocated (DBusString *str,
56 void _dbus_string_free (DBusString *str);
57 void _dbus_string_lock (DBusString *str);
58 char* _dbus_string_get_data (DBusString *str);
59 const char* _dbus_string_get_const_data (const DBusString *str);
60 char* _dbus_string_get_data_len (DBusString *str,
63 const char* _dbus_string_get_const_data_len (const DBusString *str,
66 void _dbus_string_set_byte (DBusString *str,
69 unsigned char _dbus_string_get_byte (const DBusString *str,
71 dbus_bool_t _dbus_string_insert_byte (DBusString *str,
74 dbus_bool_t _dbus_string_steal_data (DBusString *str,
76 dbus_bool_t _dbus_string_steal_data_len (DBusString *str,
80 dbus_bool_t _dbus_string_copy_data (const DBusString *str,
82 dbus_bool_t _dbus_string_copy_data_len (const DBusString *str,
86 int _dbus_string_get_length (const DBusString *str);
87 dbus_bool_t _dbus_string_lengthen (DBusString *str,
88 int additional_length);
89 void _dbus_string_shorten (DBusString *str,
90 int length_to_remove);
91 dbus_bool_t _dbus_string_set_length (DBusString *str,
93 dbus_bool_t _dbus_string_align_length (DBusString *str,
95 dbus_bool_t _dbus_string_append (DBusString *str,
97 dbus_bool_t _dbus_string_append_len (DBusString *str,
100 dbus_bool_t _dbus_string_append_int (DBusString *str,
102 dbus_bool_t _dbus_string_append_uint (DBusString *str,
103 unsigned long value);
104 dbus_bool_t _dbus_string_append_double (DBusString *str,
106 dbus_bool_t _dbus_string_append_byte (DBusString *str,
108 dbus_bool_t _dbus_string_append_unichar (DBusString *str,
110 dbus_bool_t _dbus_string_append_4_aligned (DBusString *str,
111 const unsigned char octets[4]);
112 dbus_bool_t _dbus_string_append_8_aligned (DBusString *str,
113 const unsigned char octets[8]);
114 void _dbus_string_delete (DBusString *str,
117 dbus_bool_t _dbus_string_move (DBusString *source,
121 dbus_bool_t _dbus_string_copy (const DBusString *source,
125 dbus_bool_t _dbus_string_move_len (DBusString *source,
130 dbus_bool_t _dbus_string_copy_len (const DBusString *source,
135 dbus_bool_t _dbus_string_replace_len (const DBusString *source,
141 void _dbus_string_get_unichar (const DBusString *str,
143 dbus_unichar_t *ch_return,
145 dbus_bool_t _dbus_string_parse_int (const DBusString *str,
149 dbus_bool_t _dbus_string_parse_uint (const DBusString *str,
151 unsigned long *value_return,
153 dbus_bool_t _dbus_string_parse_double (const DBusString *str,
157 dbus_bool_t _dbus_string_find (const DBusString *str,
161 dbus_bool_t _dbus_string_find_to (const DBusString *str,
166 dbus_bool_t _dbus_string_find_byte_backward (const DBusString *str,
170 dbus_bool_t _dbus_string_find_blank (const DBusString *str,
173 void _dbus_string_skip_blank (const DBusString *str,
176 void _dbus_string_skip_white (const DBusString *str,
179 dbus_bool_t _dbus_string_equal (const DBusString *a,
180 const DBusString *b);
181 dbus_bool_t _dbus_string_equal_c_str (const DBusString *a,
183 dbus_bool_t _dbus_string_equal_len (const DBusString *a,
186 dbus_bool_t _dbus_string_starts_with_c_str (const DBusString *a,
188 dbus_bool_t _dbus_string_ends_with_c_str (const DBusString *a,
190 dbus_bool_t _dbus_string_pop_line (DBusString *source,
192 void _dbus_string_delete_first_word (DBusString *str);
193 void _dbus_string_delete_leading_blanks (DBusString *str);
194 dbus_bool_t _dbus_string_base64_encode (const DBusString *source,
198 dbus_bool_t _dbus_string_base64_decode (const DBusString *source,
202 dbus_bool_t _dbus_string_hex_encode (const DBusString *source,
206 dbus_bool_t _dbus_string_hex_decode (const DBusString *source,
210 dbus_bool_t _dbus_string_validate_ascii (const DBusString *str,
213 dbus_bool_t _dbus_string_validate_utf8 (const DBusString *str,
216 dbus_bool_t _dbus_string_validate_nul (const DBusString *str,
219 dbus_bool_t _dbus_string_validate_name (const DBusString *str,
222 dbus_bool_t _dbus_string_validate_service (const DBusString *str,
225 void _dbus_string_zero (DBusString *str);
230 #endif /* DBUS_STRING_H */