dbus-string.h revision 993be1059afcb0e9a5b67f5287fb1122d6c48ce6
1/* -*- mode: C; c-file-style: "gnu" -*- */ 2/* dbus-string.h String utility class (internal to D-BUS implementation) 3 * 4 * Copyright (C) 2002 Red Hat, Inc. 5 * 6 * Licensed under the Academic Free License version 1.2 7 * 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. 12 * 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. 17 * 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 21 * 22 */ 23 24#ifndef DBUS_STRING_H 25#define DBUS_STRING_H 26 27#include <config.h> 28 29#include <dbus/dbus-memory.h> 30#include <dbus/dbus-types.h> 31 32DBUS_BEGIN_DECLS; 33 34typedef struct DBusString DBusString; 35 36struct DBusString 37{ 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}; 46 47dbus_bool_t _dbus_string_init (DBusString *str, 48 int max_length); 49void _dbus_string_init_const (DBusString *str, 50 const char *value); 51void _dbus_string_free (DBusString *str); 52void _dbus_string_lock (DBusString *str); 53 54void _dbus_string_get_data (DBusString *str, 55 char **data_return); 56void _dbus_string_get_const_data (const DBusString *str, 57 const char **data_return); 58void _dbus_string_get_data_len (DBusString *str, 59 char **data_return, 60 int start, 61 int len); 62void _dbus_string_get_const_data_len (const DBusString *str, 63 const char **data_return, 64 int start, 65 int len); 66dbus_bool_t _dbus_string_steal_data (DBusString *str, 67 char **data_return); 68dbus_bool_t _dbus_string_steal_data_len (DBusString *str, 69 char **data_return, 70 int start, 71 int len); 72 73int _dbus_string_get_length (const DBusString *str); 74 75dbus_bool_t _dbus_string_lengthen (DBusString *str, 76 int additional_length); 77void _dbus_string_shorten (DBusString *str, 78 int length_to_remove); 79dbus_bool_t _dbus_string_set_length (DBusString *str, 80 int length); 81dbus_bool_t _dbus_string_align_length (DBusString *str, 82 int alignment); 83 84dbus_bool_t _dbus_string_append (DBusString *str, 85 const char *buffer); 86dbus_bool_t _dbus_string_append_len (DBusString *str, 87 const char *buffer, 88 int len); 89dbus_bool_t _dbus_string_append_int (DBusString *str, 90 long value); 91dbus_bool_t _dbus_string_append_double (DBusString *str, 92 double value); 93dbus_bool_t _dbus_string_append_byte (DBusString *str, 94 unsigned char byte); 95dbus_bool_t _dbus_string_append_unichar (DBusString *str, 96 dbus_unichar_t ch); 97 98 99void _dbus_string_delete (DBusString *str, 100 int start, 101 int len); 102dbus_bool_t _dbus_string_move (DBusString *source, 103 int start, 104 DBusString *dest, 105 int insert_at); 106dbus_bool_t _dbus_string_copy (const DBusString *source, 107 int start, 108 DBusString *dest, 109 int insert_at); 110dbus_bool_t _dbus_string_move_len (DBusString *source, 111 int start, 112 int len, 113 DBusString *dest, 114 int insert_at); 115dbus_bool_t _dbus_string_copy_len (const DBusString *source, 116 int start, 117 int len, 118 DBusString *dest, 119 int insert_at); 120 121 122void _dbus_string_get_unichar (const DBusString *str, 123 int start, 124 dbus_unichar_t *ch_return, 125 int *end_return); 126 127dbus_bool_t _dbus_string_parse_int (const DBusString *str, 128 int start, 129 long *value_return, 130 int *end_return); 131dbus_bool_t _dbus_string_parse_double (const DBusString *str, 132 int start, 133 double *value, 134 int *end_return); 135 136dbus_bool_t _dbus_string_find (const DBusString *str, 137 int start, 138 const char *substr, 139 int *found); 140 141dbus_bool_t _dbus_string_find_blank (const DBusString *str, 142 int start, 143 int *found); 144 145void _dbus_string_skip_blank (const DBusString *str, 146 int start, 147 int *end); 148 149dbus_bool_t _dbus_string_equal (const DBusString *a, 150 const DBusString *b); 151 152dbus_bool_t _dbus_string_equal_c_str (const DBusString *a, 153 const char *c_str); 154 155dbus_bool_t _dbus_string_base64_encode (const DBusString *source, 156 int start, 157 DBusString *dest, 158 int insert_at); 159dbus_bool_t _dbus_string_base64_decode (const DBusString *source, 160 int start, 161 DBusString *dest, 162 int insert_at); 163 164dbus_bool_t _dbus_string_validate_ascii (const DBusString *str, 165 int start, 166 int len); 167 168DBUS_END_DECLS; 169 170#endif /* DBUS_STRING_H */ 171