00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include <stdio.h>
00013 #include <stdarg.h>
00014
00015 #import "OFObject.h"
00016
00017 typedef uint32_t of_unichar_t;
00018
00019 enum of_string_encoding {
00020 OF_STRING_ENCODING_UTF_8,
00021 OF_STRING_ENCODING_ISO_8859_1,
00022 OF_STRING_ENCODING_ISO_8859_15,
00023 OF_STRING_ENCODING_WINDOWS_1252
00024 };
00025
00026 extern int of_string_check_utf8(const char*, size_t);
00027 extern size_t of_string_unicode_to_utf8(of_unichar_t, char*);
00028 extern size_t of_string_utf8_to_unicode(const char*, size_t, of_unichar_t*);
00029 extern size_t of_string_position_to_index(const char*, size_t);
00030 extern size_t of_string_index_to_position(const char*, size_t, size_t);
00031
00032 @class OFArray;
00033
00037 @interface OFString: OFObject <OFCopying, OFMutableCopying>
00038 {
00039 char *string;
00040 unsigned int length;
00041 #if defined(OF_APPLE_RUNTIME) && __LP64__
00042 int _unused;
00043 #endif
00044 BOOL is_utf8;
00045 }
00046
00050 + string;
00051
00058 + stringWithCString: (const char*)str;
00059
00067 + stringWithCString: (const char*)str
00068 encoding: (enum of_string_encoding)encoding;
00069
00079 + stringWithCString: (const char*)str
00080 encoding: (enum of_string_encoding)encoding
00081 length: (size_t)len;
00082
00091 + stringWithCString: (const char*)str
00092 length: (size_t)len;
00093
00101 + stringWithFormat: (OFString*)fmt, ...;
00102
00109 + stringWithString: (OFString*)str;
00110
00116 - init;
00117
00124 - initWithCString: (const char*)str;
00125
00134 - initWithCString: (const char*)str
00135 encoding: (enum of_string_encoding)encoding;
00136
00146 - initWithCString: (const char*)str
00147 encoding: (enum of_string_encoding)encoding
00148 length: (size_t)len;
00149
00158 - initWithCString: (const char*)str
00159 length: (size_t)len;
00160
00168 - initWithFormat: (OFString*)fmt, ...;
00169
00178 - initWithFormat: (OFString*)fmt
00179 arguments: (va_list)args;
00180
00187 - initWithString: (OFString*)str;
00188
00192 - (const char*)cString;
00193
00197 - (size_t)length;
00198
00202 - (size_t)cStringLength;
00203
00210 - (of_comparison_result_t)compare: (OFString*)str;
00211
00218 - (of_comparison_result_t)caseInsensitiveCompare: (OFString*)str;
00219
00224 - (of_unichar_t)characterAtIndex: (size_t)index;
00225
00231 - (size_t)indexOfFirstOccurrenceOfString: (OFString*)str;
00232
00238 - (size_t)indexOfLastOccurrenceOfString: (OFString*)str;
00239
00246 - (OFString*)substringFromIndex: (size_t)start
00247 toIndex: (size_t)end;
00248
00255 - (OFString*)stringByAppendingString: (OFString*)str;
00256
00263 - (BOOL)hasPrefix: (OFString*)prefix;
00264
00271 - (BOOL)hasSuffix: (OFString*)suffix;
00272
00279 - (OFArray*)splitWithDelimiter: (OFString*)delimiter;
00280
00287 - (intmax_t)decimalValueAsInteger;
00288
00295 - (intmax_t)hexadecimalValueAsInteger;
00296 @end
00297
00298 #import "OFConstString.h"
00299 #import "OFMutableString.h"
00300 #import "OFHashes.h"
00301 #import "OFURLEncoding.h"
00302 #import "OFXMLElement.h"
00303 #import "OFXMLParser.h"