00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef __G_STRFUNCS_H__
00029 #define __G_STRFUNCS_H__
00030
00031 #include <_ansi.h>
00032 #include <stdarg.h>
00033 #include <glib/gtypes.h>
00034
00035 G_BEGIN_DECLS
00036
00037
00038 typedef enum {
00039 G_ASCII_ALNUM = 1 << 0,
00040 G_ASCII_ALPHA = 1 << 1,
00041 G_ASCII_CNTRL = 1 << 2,
00042 G_ASCII_DIGIT = 1 << 3,
00043 G_ASCII_GRAPH = 1 << 4,
00044 G_ASCII_LOWER = 1 << 5,
00045 G_ASCII_PRINT = 1 << 6,
00046 G_ASCII_PUNCT = 1 << 7,
00047 G_ASCII_SPACE = 1 << 8,
00048 G_ASCII_UPPER = 1 << 9,
00049 G_ASCII_XDIGIT = 1 << 10
00050 } GAsciiType;
00051
00052 #ifdef SYMBIAN
00053 IMPORT_C const guint16 * const * _g_ascii_table();
00054 #endif
00055 GLIB_VAR const guint16 * const g_ascii_table;
00056
00057 #define g_ascii_isalnum(c) \
00058 ((g_ascii_table[(guchar) (c)] & G_ASCII_ALNUM) != 0)
00059
00060 #define g_ascii_isalpha(c) \
00061 ((g_ascii_table[(guchar) (c)] & G_ASCII_ALPHA) != 0)
00062
00063 #define g_ascii_iscntrl(c) \
00064 ((g_ascii_table[(guchar) (c)] & G_ASCII_CNTRL) != 0)
00065
00066 #define g_ascii_isdigit(c) \
00067 ((g_ascii_table[(guchar) (c)] & G_ASCII_DIGIT) != 0)
00068
00069 #define g_ascii_isgraph(c) \
00070 ((g_ascii_table[(guchar) (c)] & G_ASCII_GRAPH) != 0)
00071
00072 #define g_ascii_islower(c) \
00073 ((g_ascii_table[(guchar) (c)] & G_ASCII_LOWER) != 0)
00074
00075 #define g_ascii_isprint(c) \
00076 ((g_ascii_table[(guchar) (c)] & G_ASCII_PRINT) != 0)
00077
00078 #define g_ascii_ispunct(c) \
00079 ((g_ascii_table[(guchar) (c)] & G_ASCII_PUNCT) != 0)
00080
00081 #define g_ascii_isspace(c) \
00082 ((g_ascii_table[(guchar) (c)] & G_ASCII_SPACE) != 0)
00083
00084 #define g_ascii_isupper(c) \
00085 ((g_ascii_table[(guchar) (c)] & G_ASCII_UPPER) != 0)
00086
00087 #define g_ascii_isxdigit(c) \
00088 ((g_ascii_table[(guchar) (c)] & G_ASCII_XDIGIT) != 0)
00089
00090 IMPORT_C gchar g_ascii_tolower (gchar c) G_GNUC_CONST;
00091 IMPORT_C gchar g_ascii_toupper (gchar c) G_GNUC_CONST;
00092
00093 gint g_ascii_digit_value (gchar c) G_GNUC_CONST;
00094 gint g_ascii_xdigit_value (gchar c) G_GNUC_CONST;
00095
00096
00097
00098
00099 #define G_STR_DELIMITERS "_-|> <."
00100 IMPORT_C gchar* g_strdelimit (gchar *string,
00101 const gchar *delimiters,
00102 gchar new_delimiter);
00103 IMPORT_C gchar* g_strcanon (gchar *string,
00104 const gchar *valid_chars,
00105 gchar substitutor);
00106 IMPORT_C G_CONST_RETURN gchar* g_strerror (gint errnum) G_GNUC_CONST;
00107 IMPORT_C G_CONST_RETURN gchar* g_strsignal (gint signum) G_GNUC_CONST;
00108 IMPORT_C gchar* g_strreverse (gchar *string);
00109 IMPORT_C gsize g_strlcpy (gchar *dest,
00110 const gchar *src,
00111 gsize dest_size);
00112 IMPORT_C gsize g_strlcat (gchar *dest,
00113 const gchar *src,
00114 gsize dest_size);
00115 IMPORT_C gchar * g_strstr_len (const gchar *haystack,
00116 gssize haystack_len,
00117 const gchar *needle);
00118 IMPORT_C gchar * g_strrstr (const gchar *haystack,
00119 const gchar *needle);
00120 IMPORT_C gchar * g_strrstr_len (const gchar *haystack,
00121 gssize haystack_len,
00122 const gchar *needle);
00123
00124 IMPORT_C gboolean g_str_has_suffix (const gchar *str,
00125 const gchar *suffix);
00126 IMPORT_C gboolean g_str_has_prefix (const gchar *str,
00127 const gchar *prefix);
00128
00129
00130
00131 IMPORT_C gdouble g_strtod (const gchar *nptr,
00132 gchar **endptr);
00133 IMPORT_C gdouble g_ascii_strtod (const gchar *nptr,
00134 gchar **endptr);
00135 IMPORT_C guint64 g_ascii_strtoull (const gchar *nptr,
00136 gchar **endptr,
00137 guint base);
00138
00139
00140
00141 #define G_ASCII_DTOSTR_BUF_SIZE (29 + 10)
00142 IMPORT_C gchar * g_ascii_dtostr (gchar *buffer,
00143 gint buf_len,
00144 gdouble d);
00145 IMPORT_C gchar * g_ascii_formatd (gchar *buffer,
00146 gint buf_len,
00147 const gchar *format,
00148 gdouble d);
00149
00150
00151 IMPORT_C gchar* g_strchug (gchar *string);
00152
00153 IMPORT_C gchar* g_strchomp (gchar *string);
00154
00155 #define g_strstrip( string ) g_strchomp (g_strchug (string))
00156
00157 IMPORT_C gint g_ascii_strcasecmp (const gchar *s1,
00158 const gchar *s2);
00159 IMPORT_C gint g_ascii_strncasecmp (const gchar *s1,
00160 const gchar *s2,
00161 gsize n);
00162 IMPORT_C gchar* g_ascii_strdown (const gchar *str,
00163 gssize len) G_GNUC_MALLOC;
00164 IMPORT_C gchar* g_ascii_strup (const gchar *str,
00165 gssize len) G_GNUC_MALLOC;
00166
00167 #ifndef G_DISABLE_DEPRECATED
00168
00169
00170
00171
00172
00173
00174 IMPORT_C gint g_strcasecmp (const gchar *s1,
00175 const gchar *s2);
00176 IMPORT_C gint g_strncasecmp (const gchar *s1,
00177 const gchar *s2,
00178 guint n);
00179 IMPORT_C gchar* g_strdown (gchar *string);
00180 IMPORT_C gchar* g_strup (gchar *string);
00181
00182 #endif
00183
00184
00185
00186
00187 IMPORT_C gchar* g_strdup (const gchar *str) G_GNUC_MALLOC;
00188 IMPORT_C gchar* g_strdup_printf (const gchar *format,
00189 ...) G_GNUC_PRINTF (1, 2) G_GNUC_MALLOC;
00190 IMPORT_C gchar* g_strdup_vprintf (const gchar *format,
00191 va_list args) G_GNUC_MALLOC;
00192 IMPORT_C gchar* g_strndup (const gchar *str,
00193 gsize n) G_GNUC_MALLOC;
00194 IMPORT_C gchar* g_strnfill (gsize length,
00195 gchar fill_char) G_GNUC_MALLOC;
00196 IMPORT_C gchar* g_strconcat (const gchar *string1,
00197 ...) G_GNUC_MALLOC G_GNUC_NULL_TERMINATED;
00198 IMPORT_C gchar* g_strjoin (const gchar *separator,
00199 ...) G_GNUC_MALLOC G_GNUC_NULL_TERMINATED;
00200
00201
00202
00203
00204
00205 IMPORT_C gchar* g_strcompress (const gchar *source) G_GNUC_MALLOC;
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215 IMPORT_C gchar* g_strescape (const gchar *source,
00216 const gchar *exceptions) G_GNUC_MALLOC;
00217
00218 IMPORT_C gpointer g_memdup (gconstpointer mem,
00219 guint byte_size) G_GNUC_MALLOC;
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230 IMPORT_C gchar** g_strsplit (const gchar *string,
00231 const gchar *delimiter,
00232 gint max_tokens) G_GNUC_MALLOC;
00233 IMPORT_C gchar ** g_strsplit_set (const gchar *string,
00234 const gchar *delimiters,
00235 gint max_tokens) G_GNUC_MALLOC;
00236 IMPORT_C gchar* g_strjoinv (const gchar *separator,
00237 gchar **str_array) G_GNUC_MALLOC;
00238 IMPORT_C void g_strfreev (gchar **str_array);
00239 IMPORT_C gchar** g_strdupv (gchar **str_array) G_GNUC_MALLOC;
00240 IMPORT_C guint g_strv_length (gchar **str_array);
00241
00242 IMPORT_C gchar* g_stpcpy (gchar *dest,
00243 const char *src);
00244
00245 IMPORT_C G_CONST_RETURN gchar *g_strip_context (const gchar *msgid,
00246 const gchar *msgval);
00247
00248 G_END_DECLS
00249
00250 #endif