ObjFW  Diff

Differences From Artifact [bf385a3e5c]:

To Artifact [8719bc5cf6]:


70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
 * 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   *cString;
		size_t cStringLength;
		BOOL   UTF8;
		size_t length;
	} *restrict s;
	/*
	 * Unused in OFString, however, OFConstantString sets this to SIZE_MAX
	 * once it allocated and initialized the struct.
	 */
	size_t initialized;
}

#ifdef OF_HAVE_PROPERTIES
@property (readonly) size_t length;
#endif

/**
 * \brief Creates a new OFString.
 *







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







70
71
72
73
74
75
76























77
78
79
80
81
82
83
 * 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>























#ifdef OF_HAVE_PROPERTIES
@property (readonly) size_t length;
#endif

/**
 * \brief Creates a new OFString.
 *
590
591
592
593
594
595
596










597
598
599
600
601
602
603
 * \brief Returns the Unicode character at the specified index.
 *
 * \param index The index of the Unicode character to return
 * \return The Unicode character at the specified index
 */
- (of_unichar_t)characterAtIndex: (size_t)index;











/**
 * \brief Returns the index of the first occurrence of the string.
 *
 * \param string The string to search
 * \return The index of the first occurrence of the string or OF_INVALID_INDEX
 *	   if it was not found
 */







>
>
>
>
>
>
>
>
>
>







567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
 * \brief Returns the Unicode character at the specified index.
 *
 * \param index The index of the Unicode character to return
 * \return The Unicode character at the specified index
 */
- (of_unichar_t)characterAtIndex: (size_t)index;

/**
 * \brief Copies the Unicode characters in the specified range to the specified
 *	  buffer.
 *
 * \param buffer The buffer to store the Unicode characters
 * \param range The range of the Unicode characters to copy
 */
- (void)getCharacters: (of_unichar_t*)buffer
	      inRange: (of_range_t)range;

/**
 * \brief Returns the index of the first occurrence of the string.
 *
 * \param string The string to search
 * \return The index of the first occurrence of the string or OF_INVALID_INDEX
 *	   if it was not found
 */