@@ -73,16 +73,10 @@ @class OFArray; @class OFURL; /** * \brief A class for handling strings. - * - * Warning: 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 #ifdef OF_HAVE_PROPERTIES @property (readonly) size_t length; @@ -115,11 +109,11 @@ length: (size_t)UTF8StringLength; /** * \brief Creates a new OFString from a C string with the specified encoding. * - * \param string A C string to initialize the OFString with + * \param cString A C string to initialize the OFString with * \param encoding The encoding of the C string * \return A new autoreleased OFString */ + (instancetype)stringWithCString: (const char*)cString encoding: (of_string_encoding_t)encoding; @@ -247,11 +241,11 @@ * \brief Creates a new OFString containing the constructed specified path. * * \param firstComponent The first component of the path * \return A new autoreleased OFString */ -+ (instancetype)stringWithPath: (OFString*)firstComponent, ...; ++ (instancetype)stringWithPath: (OFString*)firstComponent, ... OF_SENTINEL; /** * \brief Creates a new OFString with the contents of the specified UTF-8 * encoded file. * @@ -479,11 +473,11 @@ * specified path. * * \param firstComponent The first component of the path * \return A new autoreleased OFString */ -- initWithPath: (OFString*)firstComponent, ...; +- initWithPath: (OFString*)firstComponent, ... OF_SENTINEL; /** * \brief Initializes an already allocated OFString with the constructed * specified path. * @@ -626,11 +620,12 @@ /** * \brief Returns the range of the string. * * \param string The string to search * \param options Options modifying search behaviour. - * Possible values: OF_STRING_SEARCH_BACKWARDS + * Possible values: + * * OF_STRING_SEARCH_BACKWARDS * \return The range of the first occurrence of the string or a range with * OF_NOT_FOUND as start position if it was not found */ - (of_range_t)rangeOfString: (OFString*)string options: (int)options; @@ -638,11 +633,12 @@ /** * \brief Returns the range of the string in the specified range. * * \param string The string to search * \param options Options modifying search behaviour. - * Possible values: OF_STRING_SEARCH_BACKWARDS + * Possible values: + * * OF_STRING_SEARCH_BACKWARDS * \param range The range in which to search * \return The range of the first occurrence of the string or a range with * OF_NOT_FOUND as start position if it was not found */ - (of_range_t)rangeOfString: (OFString*)string @@ -705,11 +701,12 @@ * string in the specified range with the specified replacement. * * \param string The string to replace * \param replacement The string with which it should be replaced * \param options Options modifying search behaviour. - * Possible values: None yet + * Possible values: + * * None yet * \param range The range in which to replace the string * \return A new string with the occurrences of the specified string replaced */ - (OFString*)stringByReplacingOccurrencesOfString: (OFString*)string withString: (OFString*)replacement @@ -731,11 +728,11 @@ - (OFString*)lowercaseString; /** * \brief Returns the string capitalized. * - * \note This only considers spaces, tab and newlines to be word delimiters! + * \note This only considers spaces, tabs and newlines to be word delimiters! * Also note that this might change in the future to all word delimiters * specified by Unicode! * * \return The capitalized string */ @@ -789,12 +786,13 @@ /** * \brief Separates an OFString into an OFArray of OFStrings. * * \param delimiter The delimiter for separating - * \param options Options according to which the string should be separated - * Possible values: OF_STRING_SKIP_EMPTY + * \param options Options according to which the string should be separated. + * Possible values: + * * OF_STRING_SKIP_EMPTY * \return An autoreleased OFArray with the separated string */ - (OFArray*)componentsSeparatedByString: (OFString*)delimiter options: (int)options;