String.h (muscle7.61) | : | String.h (muscle7.62) | ||
---|---|---|---|---|
skipping to change at line 381 | skipping to change at line 381 | |||
/** Returns a read-only C-style pointer to our held character string. */ | /** Returns a read-only C-style pointer to our held character string. */ | |||
const char * Cstr() const {return IsArrayDynamicallyAllocated() ? _strData._b igBuffer : _strData._smallBuffer;} | const char * Cstr() const {return IsArrayDynamicallyAllocated() ? _strData._b igBuffer : _strData._smallBuffer;} | |||
/** Convenience synonym for Cstr(). */ | /** Convenience synonym for Cstr(). */ | |||
const char * operator()() const {return Cstr();} | const char * operator()() const {return Cstr();} | |||
/** Clears this string so that it contains no characters. Equivalent to sett ing this string to "". */ | /** Clears this string so that it contains no characters. Equivalent to sett ing this string to "". */ | |||
void Clear() {_length = 0; WriteNULTerminatorByte();} | void Clear() {_length = 0; WriteNULTerminatorByte();} | |||
/** Similar to Clear(), except this version also frees up any dynamically all ocated character arary we may have cached. */ | /** Similar to Clear(), except this version also frees up any dynamically all ocated character array we may have cached. */ | |||
void ClearAndFlush(); | void ClearAndFlush(); | |||
/** Shrinks our internally allocated buffer down so that it is just big enoug h to hold the current string (plus numExtraBytes) | /** Shrinks our internally allocated buffer down so that it is just big enoug h to hold the current string (plus numExtraBytes) | |||
* @param numExtraBytes an additional number of bytes that the buffer should have room for. Defaults to zero. | * @param numExtraBytes an additional number of bytes that the buffer should have room for. Defaults to zero. | |||
* @returns B_NO_ERROR on success, or an error code on failure (although I d on't know why this method would ever fail). | * @returns B_NO_ERROR on success, or an error code on failure (although I d on't know why this method would ever fail). | |||
*/ | */ | |||
status_t ShrinkToFit(uint32 numExtraBytes = 0) {return EnsureBufferSize(Flatt enedSize()+numExtraBytes, true, true);} | status_t ShrinkToFit(uint32 numExtraBytes = 0) {return EnsureBufferSize(Flatt enedSize()+numExtraBytes, true, true);} | |||
/** Sets our state from the given C-style string. | /** Sets our state from the given C-style string. | |||
* @param str The new string to copy from. If maxLen is negative, this may be NULL. | * @param str The new string to copy from. If maxLen is negative, this may be NULL. | |||
skipping to change at line 1158 | skipping to change at line 1158 | |||
* @param c The char we want to be sure is not at the end of the returned St ring. | * @param c The char we want to be sure is not at the end of the returned St ring. | |||
* @param maxToRemove Maximum number of instances of (c) to remove from the returned String. | * @param maxToRemove Maximum number of instances of (c) to remove from the returned String. | |||
* Defaults to MUSCLE_NO_LIMIT, i.e. remove all trailing (c) chars. | * Defaults to MUSCLE_NO_LIMIT, i.e. remove all trailing (c) chars. | |||
*/ | */ | |||
String WithoutSuffix(char c, uint32 maxToRemove = MUSCLE_NO_LIMIT) const; | String WithoutSuffix(char c, uint32 maxToRemove = MUSCLE_NO_LIMIT) const; | |||
/** Returns a String like this one, but with any instances of (str) removed f rom the end. | /** Returns a String like this one, but with any instances of (str) removed f rom the end. | |||
* @param str The substring we want to be sure is not at the end of the retu rned String. | * @param str The substring we want to be sure is not at the end of the retu rned String. | |||
* @param maxToRemove Maximum number of instances of (c) to remove from the returned String. | * @param maxToRemove Maximum number of instances of (c) to remove from the returned String. | |||
* Defaults to MUSCLE_NO_LIMIT, i.e. remove all trailing (str) substrings. | * Defaults to MUSCLE_NO_LIMIT, i.e. remove all trailing (str) substrings. | |||
* @note if (str) is empty, this method will return (*this). | ||||
*/ | */ | |||
String WithoutSuffix(const String & str, uint32 maxToRemove = MUSCLE_NO_LIMIT ) const; | String WithoutSuffix(const String & str, uint32 maxToRemove = MUSCLE_NO_LIMIT ) const; | |||
/** Returns a String like this one, but with any characters (c) removed from the beginning. | /** Returns a String like this one, but with any characters (c) removed from the beginning. | |||
* @param c The char we want to be sure is not at the beginning of the retur ned String. | * @param c The char we want to be sure is not at the beginning of the retur ned String. | |||
* @param maxToRemove Maximum number of instances of (c) to remove from the returned String. | * @param maxToRemove Maximum number of instances of (c) to remove from the returned String. | |||
* Defaults to MUSCLE_NO_LIMIT, i.e. remove all starting (c) chars. | * Defaults to MUSCLE_NO_LIMIT, i.e. remove all starting (c) chars. | |||
*/ | */ | |||
String WithoutPrefix(char c, uint32 maxToRemove = MUSCLE_NO_LIMIT) const; | String WithoutPrefix(char c, uint32 maxToRemove = MUSCLE_NO_LIMIT) const; | |||
/** Returns a String like this one, but with any instances of (str) removed f rom the beginning. | /** Returns a String like this one, but with any instances of (str) removed f rom the beginning. | |||
* @param str The substring we want to be sure is not at the beginning of th e returned String. | * @param str The substring we want to be sure is not at the beginning of th e returned String. | |||
* @param maxToRemove Maximum number of instances of (c) to remove from the returned String. | * @param maxToRemove Maximum number of instances of (c) to remove from the returned String. | |||
* Defaults to MUSCLE_NO_LIMIT, i.e. remove all starting (str) substrings. | * Defaults to MUSCLE_NO_LIMIT, i.e. remove all starting (str) substrings. | |||
* @note if (str) is empty, this method will return (*this). | ||||
*/ | */ | |||
String WithoutPrefix(const String & str, uint32 maxToRemove = MUSCLE_NO_LIMIT ) const; | String WithoutPrefix(const String & str, uint32 maxToRemove = MUSCLE_NO_LIMIT ) const; | |||
/** Returns a String like this one, but with any characters (c) removed from the end. | /** Returns a String like this one, but with any characters (c) removed from the end. | |||
* @param c The char we want to be sure is not at the end of the returned St ring (case-insensitive). | * @param c The char we want to be sure is not at the end of the returned St ring (case-insensitive). | |||
* @param maxToRemove Maximum number of instances of (c) to remove from the returned String. | * @param maxToRemove Maximum number of instances of (c) to remove from the returned String. | |||
* Defaults to MUSCLE_NO_LIMIT, i.e. remove all trailing (c) chars. | * Defaults to MUSCLE_NO_LIMIT, i.e. remove all trailing (c) chars. | |||
*/ | */ | |||
String WithoutSuffixIgnoreCase(char c, uint32 maxToRemove = MUSCLE_NO_LIMIT) const; | String WithoutSuffixIgnoreCase(char c, uint32 maxToRemove = MUSCLE_NO_LIMIT) const; | |||
/** Returns a String like this one, but with any instances of (str) removed f rom the end. | /** Returns a String like this one, but with any instances of (str) removed f rom the end. | |||
* @param str The substring we want to be sure is not at the end of the retu rned String (case-insensitive). | * @param str The substring we want to be sure is not at the end of the retu rned String (case-insensitive). | |||
* @param maxToRemove Maximum number of instances of (c) to remove from the returned String. | * @param maxToRemove Maximum number of instances of (c) to remove from the returned String. | |||
* Defaults to MUSCLE_NO_LIMIT, i.e. remove all trailing (str) substrings. | * Defaults to MUSCLE_NO_LIMIT, i.e. remove all trailing (str) substrings. | |||
* @note if (str) is empty, this method will return (*this). | ||||
*/ | */ | |||
String WithoutSuffixIgnoreCase(const String & str, uint32 maxToRemove = MUSCL E_NO_LIMIT) const; | String WithoutSuffixIgnoreCase(const String & str, uint32 maxToRemove = MUSCL E_NO_LIMIT) const; | |||
/** Returns a String like this one, but with any characters (c) removed from the beginning. | /** Returns a String like this one, but with any characters (c) removed from the beginning. | |||
* @param c The char we want to be sure is not at the beginning of the retur ned String (case-insensitive). | * @param c The char we want to be sure is not at the beginning of the retur ned String (case-insensitive). | |||
* @param maxToRemove Maximum number of instances of (c) to remove from the returned String. | * @param maxToRemove Maximum number of instances of (c) to remove from the returned String. | |||
* Defaults to MUSCLE_NO_LIMIT, i.e. remove all starting (c) chars. | * Defaults to MUSCLE_NO_LIMIT, i.e. remove all starting (c) chars. | |||
*/ | */ | |||
String WithoutPrefixIgnoreCase(char c, uint32 maxToRemove = MUSCLE_NO_LIMIT) const; | String WithoutPrefixIgnoreCase(char c, uint32 maxToRemove = MUSCLE_NO_LIMIT) const; | |||
/** Returns a String like this one, but with any instances of (str) removed f rom the beginning. | /** Returns a String like this one, but with any instances of (str) removed f rom the beginning. | |||
* @param str The substring we want to be sure is not at the beginning of th e returned String (case-insensitive). | * @param str The substring we want to be sure is not at the beginning of th e returned String (case-insensitive). | |||
* @param maxToRemove Maximum number of instances of (c) to remove from the returned String. | * @param maxToRemove Maximum number of instances of (c) to remove from the returned String. | |||
* Defaults to MUSCLE_NO_LIMIT, i.e. remove all starting (str) substrings. | * Defaults to MUSCLE_NO_LIMIT, i.e. remove all starting (str) substrings. | |||
* @note if (str) is empty, this method will return (*this). | ||||
*/ | */ | |||
String WithoutPrefixIgnoreCase(const String & str, uint32 maxToRemove = MUSCL E_NO_LIMIT) const; | String WithoutPrefixIgnoreCase(const String & str, uint32 maxToRemove = MUSCL E_NO_LIMIT) const; | |||
/** Returns a String equal to this one, but with any integer/numeric suffix r emoved. | /** Returns a String equal to this one, but with any integer/numeric suffix r emoved. | |||
* For example, if you called this method on the String "Joe-54", this metho d would return "Joe". | * For example, if you called this method on the String "Joe-54", this metho d would return "Joe". | |||
* @param optRetRemovedSuffixValue If non-NULL, the numeric suffix that was removed will be returned here. | * @param optRetRemovedSuffixValue If non-NULL, the numeric suffix that was removed will be returned here. | |||
* If there was no numeric suffix, zero will be written here. | * If there was no numeric suffix, zero will be written here. | |||
* @note that negative numeric suffixes aren't supported -- i.e. plus or min us is not considered to be part of the numeric-suffix. | * @note that negative numeric suffixes aren't supported -- i.e. plus or min us is not considered to be part of the numeric-suffix. | |||
*/ | */ | |||
String WithoutNumericSuffix(uint32 * optRetRemovedSuffixValue = NULL) const; | String WithoutNumericSuffix(uint32 * optRetRemovedSuffixValue = NULL) const; | |||
End of changes. 5 change blocks. | ||||
1 lines changed or deleted | 5 lines changed or added |