/* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2.0.IfacopyoftheMPLwasnotdistributedwiththis
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/** *mozilla::intlAPIsrequiresizeablebuffers.Thisclassabstractsover *thensTSubstring.
*/ template <typename T> class nsTStringToBufferAdapter {
public:
using CharType = T;
// Do not allow copy or move. Move could be added in the future if needed.
nsTStringToBufferAdapter(const nsTStringToBufferAdapter&) = delete;
nsTStringToBufferAdapter& operator=(const nsTStringToBufferAdapter&) = delete;
/** *Returnsthebuffer'soverallcapacity.
*/
size_t capacity() const { // nsString's Capacity() method is protected, so just return the length. return mString.Length();
}
/** *Resizesthebuffertothegivenamountofwrittenelements.
*/ void written(size_t amount) {
MOZ_ASSERT(amount <= mString.Length()); // This sets |mString|'s internal size so that it matches how much was // written. This is necessary because the write happens across FFI // boundaries.
mString.SetLength(amount);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.