ObjFW  Diff

Differences From Artifact [21d7d8692e]:

To Artifact [78f3465255]:


51
52
53
54
55
56
57






58
59
60
61










62
63
64









65
66
67
68
69
70
71
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93







+
+
+
+
+
+




+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+







#endif

@class OFArray;
@class OFURL;

/**
 * \brief A class for handling strings.
 *
 * <b>Warning:</b> If you add methods to OFString using a category, you are not
 * allowed to access the ivars directly, as these might be still uninitialized
 * for a constant string and get initialized on the first message! Therefore,
 * you should use the corresponding methods to get the ivars, which ensures the
 * constant string is initialized.
 */
@interface OFString: OFObject <OFCopying, OFMutableCopying, OFComparing,
    OFSerialization>
{
	/*
	 * The ivars have to be like this because OFConstantString bases on
	 * OFString.
	 *
	 * The compiler generates an instance with a const char* and a size_t
	 * for each constant string. We change the const char* to point to our
	 * struct on the first call to a constant string so we can have more
	 * than those two ivars.
	 */
	struct of_string_ivars {
	char   *string;
	size_t length;
	BOOL   isUTF8;
		char   *string;
		size_t length;
		BOOL   isUTF8;
	} *restrict s;
	/*
	 * Unused in OFString, however, OFConstantString sets this to SIZE_MAX
	 * once it allocated and initialized the struct.
	 */
	size_t initialized;
}

/**
 * \return A new autoreleased OFString
 */
+ string;

505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
527
528
529
530
531
532
533




534
535
536
537
538
539
540







-
-
-
-







- (size_t)length;

/**
 * \return The length of the string which cString would return
 */
- (size_t)cStringLength;

/// \cond internal
- (BOOL)isUTF8;
/// \endcond

/**
 * Compares the OFString to another OFString without caring about the case.
 *
 * \param otherString A string to compare with
 * \return An of_comparison_result_t
 */
- (of_comparison_result_t)caseInsensitiveCompare: (OFString*)otherString;