00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef TRIO_TRIOSTR_H
00019 #define TRIO_TRIOSTR_H
00020
00021 #include <assert.h>
00022 #include <stdlib.h>
00023 #include <string.h>
00024 #include <time.h>
00025 #include "triodef.h"
00026 #include "triop.h"
00027
00028 enum {
00029 TRIO_HASH_NONE = 0,
00030 TRIO_HASH_PLAIN,
00031 TRIO_HASH_TWOSIGNED
00032 };
00033
00034 #if !defined(TRIO_STRING_PUBLIC)
00035 # if !defined(TRIO_PUBLIC)
00036 # define TRIO_PUBLIC
00037 # endif
00038 # define TRIO_STRING_PUBLIC TRIO_PUBLIC
00039 #endif
00040
00041
00042
00043
00044
00045 TRIO_STRING_PUBLIC int trio_copy_max TRIO_PROTO((char *target, size_t max, const char *source));
00046 TRIO_STRING_PUBLIC char *trio_create TRIO_PROTO((size_t size));
00047 TRIO_STRING_PUBLIC void trio_destroy TRIO_PROTO((char *string));
00048 TRIO_STRING_PUBLIC char *trio_duplicate TRIO_PROTO((const char *source));
00049 TRIO_STRING_PUBLIC int trio_equal TRIO_PROTO((const char *first, const char *second));
00050 TRIO_STRING_PUBLIC int trio_equal_case TRIO_PROTO((const char *first, const char *second));
00051 TRIO_STRING_PUBLIC int trio_equal_locale TRIO_PROTO((const char *first, const char *second));
00052 TRIO_STRING_PUBLIC int trio_equal_max TRIO_PROTO((const char *first, size_t max, const char *second));
00053 TRIO_STRING_PUBLIC TRIO_CONST char *trio_error TRIO_PROTO((int));
00054 TRIO_STRING_PUBLIC size_t trio_length TRIO_PROTO((const char *string));
00055 TRIO_STRING_PUBLIC double trio_to_double TRIO_PROTO((const char *source, char **endp));
00056 TRIO_STRING_PUBLIC long trio_to_long TRIO_PROTO((const char *source, char **endp, int base));
00057 TRIO_STRING_PUBLIC trio_long_double_t trio_to_long_double TRIO_PROTO((const char *source, char **endp));
00058 TRIO_STRING_PUBLIC int trio_to_upper TRIO_PROTO((int source));
00059
00060 #if !defined(TRIO_MINIMAL)
00061
00062 TRIO_STRING_PUBLIC int trio_append TRIO_PROTO((char *target, const char *source));
00063 TRIO_STRING_PUBLIC int trio_append_max TRIO_PROTO((char *target, size_t max, const char *source));
00064 TRIO_STRING_PUBLIC int trio_contains TRIO_PROTO((const char *string, const char *substring));
00065 TRIO_STRING_PUBLIC int trio_copy TRIO_PROTO((char *target, const char *source));
00066 TRIO_STRING_PUBLIC char *trio_duplicate_max TRIO_PROTO((const char *source, size_t max));
00067 TRIO_STRING_PUBLIC int trio_equal_case_max TRIO_PROTO((const char *first, size_t max, const char *second));
00068 TRIO_STRING_PUBLIC size_t trio_format_date_max TRIO_PROTO((char *target, size_t max, const char *format, const struct tm *datetime));
00069 TRIO_STRING_PUBLIC unsigned long trio_hash TRIO_PROTO((const char *string, int type));
00070 TRIO_STRING_PUBLIC char *trio_index TRIO_PROTO((const char *string, int character));
00071 TRIO_STRING_PUBLIC char *trio_index_last TRIO_PROTO((const char *string, int character));
00072 TRIO_STRING_PUBLIC int trio_lower TRIO_PROTO((char *target));
00073 TRIO_STRING_PUBLIC int trio_match TRIO_PROTO((const char *string, const char *pattern));
00074 TRIO_STRING_PUBLIC int trio_match_case TRIO_PROTO((const char *string, const char *pattern));
00075 TRIO_STRING_PUBLIC size_t trio_span_function TRIO_PROTO((char *target, const char *source, int (*Function) TRIO_PROTO((int))));
00076 TRIO_STRING_PUBLIC char *trio_substring TRIO_PROTO((const char *string, const char *substring));
00077 TRIO_STRING_PUBLIC char *trio_substring_max TRIO_PROTO((const char *string, size_t max, const char *substring));
00078 TRIO_STRING_PUBLIC float trio_to_float TRIO_PROTO((const char *source, char **endp));
00079 TRIO_STRING_PUBLIC int trio_to_lower TRIO_PROTO((int source));
00080 TRIO_STRING_PUBLIC unsigned long trio_to_unsigned_long TRIO_PROTO((const char *source, char **endp, int base));
00081 TRIO_STRING_PUBLIC char *trio_tokenize TRIO_PROTO((char *string, const char *delimiters));
00082 TRIO_STRING_PUBLIC int trio_upper TRIO_PROTO((char *target));
00083
00084 #endif
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094 typedef struct _trio_string_t trio_string_t;
00095
00096 TRIO_STRING_PUBLIC void trio_string_destroy TRIO_PROTO((trio_string_t *self));
00097 TRIO_STRING_PUBLIC char *trio_string_extract TRIO_PROTO((trio_string_t *self));
00098 TRIO_STRING_PUBLIC int trio_string_size TRIO_PROTO((trio_string_t *self));
00099 TRIO_STRING_PUBLIC void trio_string_terminate TRIO_PROTO((trio_string_t *self));
00100 TRIO_STRING_PUBLIC int trio_xstring_append_char TRIO_PROTO((trio_string_t *self, char character));
00101 TRIO_STRING_PUBLIC trio_string_t *trio_xstring_duplicate TRIO_PROTO((const char *other));
00102
00103 #if !defined(TRIO_MINIMAL)
00104
00105 TRIO_STRING_PUBLIC trio_string_t *trio_string_create TRIO_PROTO((int initial_size));
00106 TRIO_STRING_PUBLIC char *trio_string_get TRIO_PROTO((trio_string_t *self, int offset));
00107 TRIO_STRING_PUBLIC void trio_xstring_set TRIO_PROTO((trio_string_t *self, char *buffer));
00108
00109 TRIO_STRING_PUBLIC int trio_string_append TRIO_PROTO((trio_string_t *self, trio_string_t *other));
00110 TRIO_STRING_PUBLIC int trio_string_contains TRIO_PROTO((trio_string_t *self, trio_string_t *other));
00111 TRIO_STRING_PUBLIC int trio_string_copy TRIO_PROTO((trio_string_t *self, trio_string_t *other));
00112 TRIO_STRING_PUBLIC trio_string_t *trio_string_duplicate TRIO_PROTO((trio_string_t *other));
00113 TRIO_STRING_PUBLIC int trio_string_equal TRIO_PROTO((trio_string_t *self, trio_string_t *other));
00114 TRIO_STRING_PUBLIC int trio_string_equal_max TRIO_PROTO((trio_string_t *self, size_t max, trio_string_t *second));
00115 TRIO_STRING_PUBLIC int trio_string_equal_case TRIO_PROTO((trio_string_t *self, trio_string_t *other));
00116 TRIO_STRING_PUBLIC int trio_string_equal_case_max TRIO_PROTO((trio_string_t *self, size_t max, trio_string_t *other));
00117 TRIO_STRING_PUBLIC size_t trio_string_format_date_max TRIO_PROTO((trio_string_t *self, size_t max, const char *format, const struct tm *datetime));
00118 TRIO_STRING_PUBLIC char *trio_string_index TRIO_PROTO((trio_string_t *self, int character));
00119 TRIO_STRING_PUBLIC char *trio_string_index_last TRIO_PROTO((trio_string_t *self, int character));
00120 TRIO_STRING_PUBLIC int trio_string_length TRIO_PROTO((trio_string_t *self));
00121 TRIO_STRING_PUBLIC int trio_string_lower TRIO_PROTO((trio_string_t *self));
00122 TRIO_STRING_PUBLIC int trio_string_match TRIO_PROTO((trio_string_t *self, trio_string_t *other));
00123 TRIO_STRING_PUBLIC int trio_string_match_case TRIO_PROTO((trio_string_t *self, trio_string_t *other));
00124 TRIO_STRING_PUBLIC char *trio_string_substring TRIO_PROTO((trio_string_t *self, trio_string_t *other));
00125 TRIO_STRING_PUBLIC int trio_string_upper TRIO_PROTO((trio_string_t *self));
00126
00127 TRIO_STRING_PUBLIC int trio_xstring_append TRIO_PROTO((trio_string_t *self, const char *other));
00128 TRIO_STRING_PUBLIC int trio_xstring_contains TRIO_PROTO((trio_string_t *self, const char *other));
00129 TRIO_STRING_PUBLIC int trio_xstring_copy TRIO_PROTO((trio_string_t *self, const char *other));
00130 TRIO_STRING_PUBLIC int trio_xstring_equal TRIO_PROTO((trio_string_t *self, const char *other));
00131 TRIO_STRING_PUBLIC int trio_xstring_equal_max TRIO_PROTO((trio_string_t *self, size_t max, const char *other));
00132 TRIO_STRING_PUBLIC int trio_xstring_equal_case TRIO_PROTO((trio_string_t *self, const char *other));
00133 TRIO_STRING_PUBLIC int trio_xstring_equal_case_max TRIO_PROTO((trio_string_t *self, size_t max, const char *other));
00134 TRIO_STRING_PUBLIC int trio_xstring_match TRIO_PROTO((trio_string_t *self, const char *other));
00135 TRIO_STRING_PUBLIC int trio_xstring_match_case TRIO_PROTO((trio_string_t *self, const char *other));
00136 TRIO_STRING_PUBLIC char *trio_xstring_substring TRIO_PROTO((trio_string_t *self, const char *other));
00137
00138 #endif
00139
00140 #endif