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 #import "OFArray.h"
00017
00018 typedef uint32_t of_unichar_t;
00019
00020 enum of_string_encoding {
00021 OF_STRING_ENCODING_UTF_8,
00022 OF_STRING_ENCODING_ISO_8859_1,
00023 OF_STRING_ENCODING_ISO_8859_15,
00024 OF_STRING_ENCODING_WINDOWS_1252
00025 };
00026
00027 extern int of_string_check_utf8(const char*, size_t);
00028 extern size_t of_string_unicode_to_utf8(of_unichar_t, char*);
00029 extern size_t of_string_utf8_to_unicode(const char*, size_t, of_unichar_t*);
00030 extern size_t of_string_position_to_index(const char*, size_t);
00031 extern size_t of_string_index_to_position(const char*, size_t, size_t);
00032
00036 @interface OFString: OFObject <OFCopying, OFMutableCopying>
00037 {
00038 char *string;
00039 unsigned int length;
00040 #if defined(OF_APPLE_RUNTIME) && __LP64__
00041 int _unused;
00042 #endif
00043 BOOL is_utf8;
00044 }
00045
00049 + string;
00050
00057 + stringWithCString: (const char*)str;
00058
00066 + stringWithCString: (const char*)str
00067 encoding: (enum of_string_encoding)encoding;
00068
00078 + stringWithCString: (const char*)str
00079 encoding: (enum of_string_encoding)encoding
00080 length: (size_t)len;
00081
00090 + stringWithCString: (const char*)str
00091 length: (size_t)len;
00092
00100 + stringWithFormat: (OFString*)fmt, ...;
00101
00108 + stringWithString: (OFString*)str;
00109
00115 - init;
00116
00123 - initWithCString: (const char*)str;
00124
00133 - initWithCString: (const char*)str
00134 encoding: (enum of_string_encoding)encoding;
00135
00145 - initWithCString: (const char*)str
00146 encoding: (enum of_string_encoding)encoding
00147 length: (size_t)len;
00148
00157 - initWithCString: (const char*)str
00158 length: (size_t)len;
00159
00167 - initWithFormat: (OFString*)fmt, ...;
00168
00177 - initWithFormat: (OFString*)fmt
00178 arguments: (va_list)args;
00179
00186 - initWithString: (OFString*)str;
00187
00191 - (const char*)cString;
00192
00196 - (size_t)length;
00197
00201 - (size_t)cStringLength;
00202
00209 - (of_comparison_result_t)compare: (OFString*)str;
00210
00217 - (of_comparison_result_t)caseInsensitiveCompare: (OFString*)str;
00218
00223 - (of_unichar_t)characterAtIndex: (size_t)index;
00224
00230 - (size_t)indexOfFirstOccurrenceOfString: (OFString*)str;
00231
00237 - (size_t)indexOfLastOccurrenceOfString: (OFString*)str;
00238
00245 - (OFString*)substringFromIndex: (size_t)start
00246 toIndex: (size_t)end;
00247
00254 - (OFString*)stringByAppendingString: (OFString*)str;
00255
00262 - (BOOL)hasPrefix: (OFString*)prefix;
00263
00270 - (BOOL)hasSuffix: (OFString*)suffix;
00271
00278 - (OFArray*)splitWithDelimiter: (OFString*)delimiter;
00279
00286 - (intmax_t)decimalValueAsInteger;
00287
00294 - (intmax_t)hexadecimalValueAsInteger;
00295
00296 - setToCString: (const char*)str;
00297 - appendCString: (const char*)str;
00298 - appendCString: (const char*)str
00299 withLength: (size_t)len;
00300 - appendCStringWithoutUTF8Checking: (const char*)str;
00301 - appendCStringWithoutUTF8Checking: (const char*)str
00302 length: (size_t)len;
00303 - appendString: (OFString*)str;
00304 - appendWithFormat: (OFString*)fmt, ...;
00305 - appendWithFormat: (OFString*)fmt
00306 arguments: (va_list)args;
00307 - reverse;
00308 - upper;
00309 - lower;
00310 - removeCharactersFromIndex: (size_t)start
00311 toIndex: (size_t)end;
00312 - replaceOccurrencesOfString: (OFString*)str
00313 withString: (OFString*)repl;
00314 - removeLeadingWhitespaces;
00315 - removeTrailingWhitespaces;
00316 - removeLeadingAndTrailingWhitespaces;
00317 @end
00318
00319 #import "OFConstString.h"
00320 #import "OFMutableString.h"
00321 #import "OFHashes.h"
00322 #import "OFURLEncoding.h"
00323 #import "OFXMLElement.h"
00324 #import "OFXMLParser.h"