Bug 1306616 - part 2 - remove nsWritingIterator<T>::write; r=erahm

Iterators shouldn't have methods like write(); if you need to write to
an iterator, that logic should be handled by something outside of the
iterator...which also explains why we have a specialization of
nsCharTraits<nsWritingIterator<T>>.  The HTML parser wants this for its
own reasons, so we have to make sure it continues to work.
This commit is contained in:
Nathan Froyd 2016-10-03 17:21:52 -04:00
parent 3806e7bb85
commit 3ca4c03f1d

View File

@ -205,15 +205,6 @@ public:
return *this;
}
void write(const value_type* aS, uint32_t aN)
{
NS_ASSERTION(mEnd - mPosition > 0,
"You can't |write| into an |nsWritingIterator| with no space!");
nsCharTraits<value_type>::move(mPosition, aS, aN);
advance(difference_type(aN));
}
// We return an unsigned type here (with corresponding assert) rather than
// the more usual difference_type because we want to make this class go
// away in favor of mozilla::RangedPtr. Since RangedPtr has the same
@ -226,6 +217,17 @@ public:
}
};
template <class CharT>
struct nsCharSinkTraits<nsWritingIterator<CharT>>
{
static void
write(nsWritingIterator<CharT>& aIter, const CharT* aStr, uint32_t aN)
{
nsCharTraits<CharT>::move(aIter.get(), aStr, aN);
aIter.advance(aN);
}
};
template <class CharT>
inline bool
operator==(const nsReadingIterator<CharT>& aLhs,