/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsHtml5String_h #define nsHtml5String_h
#include"nsAtom.h" #include"nsString.h"
namespace mozilla { class StringBuffer;
}
class nsHtml5TreeBuilder;
/** * A pass-by-value type that can represent * * nullptr * * empty string * * Non-empty string as exactly-sized (capacity is length) `StringBuffer*` * * Non-empty string as an nsAtom* * * Holding or passing this type is as unsafe as holding or passing * `StringBuffer*`/`nsAtom*`.
*/ class nsHtml5String final { private: staticconst uintptr_t kKindMask = uintptr_t(3);
/** * False iff the string is logically null
*/ inline MOZ_IMPLICIT operatorbool() const { return mBits; }
/** * Get the underlying nsAtom* or nullptr if this nsHtml5String * does not hold an atom.
*/ inline nsAtom* MaybeAsAtom() { if (GetKind() == eAtom) { return AsAtom();
} return nullptr;
}
private: /** * Constructor from raw bits.
*/ explicit nsHtml5String(uintptr_t aBits) : mBits(aBits) {};
/** * Zero if null, one if empty, otherwise tagged pointer * to either nsAtom or nsStringBuffer. The two least-significant * bits are tag bits.
*/
uintptr_t mBits;
};
#endif// nsHtml5String_h
¤ Dauer der Verarbeitung: 0.1 Sekunden
(vorverarbeitet)
¤
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 ist noch experimentell.