mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-03 02:25:34 +00:00
Bug 1344498 - Add fallible StripWhitespace r=njn
MozReview-Commit-ID: 8UOTEBlFxfO --HG-- extra : rebase_source : 2c32cf4b39f9e601b9ebe1a51639000dea9f14f7
This commit is contained in:
parent
af6a16068b
commit
427ac28f38
@ -372,12 +372,14 @@ public:
|
||||
using nsTSubstring_CharT::StripChars;
|
||||
#endif
|
||||
void StripChars(const char* aSet);
|
||||
bool StripChars(const char* aSet, const fallible_t&);
|
||||
|
||||
|
||||
/**
|
||||
* This method strips whitespace throughout the string.
|
||||
*/
|
||||
void StripWhitespace();
|
||||
bool StripWhitespace(const fallible_t&);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -407,12 +407,28 @@ nsTString_CharT::StripChars( const char* aSet )
|
||||
mLength = nsBufferRoutines<CharT>::strip_chars(mData, mLength, aSet);
|
||||
}
|
||||
|
||||
bool
|
||||
nsTString_CharT::StripChars( const char* aSet, const fallible_t& )
|
||||
{
|
||||
if (!EnsureMutable()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
mLength = nsBufferRoutines<CharT>::strip_chars(mData, mLength, aSet);
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
nsTString_CharT::StripWhitespace()
|
||||
{
|
||||
StripChars(kWhitespace);
|
||||
}
|
||||
|
||||
bool
|
||||
nsTString_CharT::StripWhitespace(const fallible_t& aFallible)
|
||||
{
|
||||
return StripChars(kWhitespace, aFallible);
|
||||
}
|
||||
|
||||
/**
|
||||
* nsTString::ReplaceChar,ReplaceSubstring
|
||||
|
Loading…
Reference in New Issue
Block a user