1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef nsHtml5AttributeEntry_h
6 #define nsHtml5AttributeEntry_h
8 #include "nsHtml5AttributeName.h"
10 class nsHtml5AttributeEntry final
{
12 nsHtml5AttributeEntry(nsHtml5AttributeName
* aName
, nsHtml5String aValue
,
14 : mLine(aLine
), mValue(aValue
) {
15 // Let's hope the compiler coalesces the following as appropriate.
16 mLocals
[0] = aName
->getLocal(0);
17 mLocals
[1] = aName
->getLocal(1);
18 mLocals
[2] = aName
->getLocal(2);
19 mPrefixes
[0] = aName
->getPrefix(0);
20 mPrefixes
[1] = aName
->getPrefix(1);
21 mPrefixes
[2] = aName
->getPrefix(2);
22 mUris
[0] = aName
->getUri(0);
23 mUris
[1] = aName
->getUri(1);
24 mUris
[2] = aName
->getUri(2);
27 // Isindex-only so doesn't need to deal with SVG and MathML
28 nsHtml5AttributeEntry(nsAtom
* aName
, nsHtml5String aValue
, int32_t aLine
)
29 : mLine(aLine
), mValue(aValue
) {
30 // Let's hope the compiler coalesces the following as appropriate.
34 mPrefixes
[0] = nullptr;
35 mPrefixes
[1] = nullptr;
36 mPrefixes
[2] = nullptr;
37 mUris
[0] = kNameSpaceID_None
;
38 mUris
[1] = kNameSpaceID_None
;
39 mUris
[2] = kNameSpaceID_None
;
42 inline nsAtom
* GetLocal(int32_t aMode
) { return mLocals
[aMode
]; }
44 inline nsAtom
* GetPrefix(int32_t aMode
) { return mPrefixes
[aMode
]; }
46 inline int32_t GetUri(int32_t aMode
) { return mUris
[aMode
]; }
48 inline nsHtml5String
GetValue() { return mValue
; }
50 inline int32_t GetLine() { return mLine
; }
52 inline void ReleaseValue() { mValue
.Release(); }
54 inline nsHtml5AttributeEntry
Clone() {
56 nsHtml5AttributeEntry
clone(*this);
57 // Increment refcount for value
58 clone
.mValue
= this->mValue
.Clone();
63 RefPtr
<nsAtom
> mLocals
[3];
64 RefPtr
<nsAtom
> mPrefixes
[3];
70 #endif // nsHtml5AttributeEntry_h