Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /* This Source Code Form is subject to the terms of the Mozilla Public
3 : * License, v. 2.0. If a copy of the MPL was not distributed with this
4 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 :
6 : #ifndef TRANSFRMX_EXPANDEDNAME_H
7 : #define TRANSFRMX_EXPANDEDNAME_H
8 :
9 : #include "nsCOMPtr.h"
10 : #include "nsIAtom.h"
11 : #include "mozilla/dom/NameSpaceConstants.h"
12 :
13 : class txNamespaceMap;
14 :
15 123 : class txExpandedName {
16 : public:
17 0 : txExpandedName() : mNamespaceID(kNameSpaceID_None)
18 : {
19 0 : }
20 :
21 123 : txExpandedName(int32_t aNsID,
22 123 : nsIAtom* aLocalName) : mNamespaceID(aNsID),
23 123 : mLocalName(aLocalName)
24 : {
25 123 : }
26 :
27 0 : txExpandedName(const txExpandedName& aOther) :
28 0 : mNamespaceID(aOther.mNamespaceID),
29 0 : mLocalName(aOther.mLocalName)
30 : {
31 0 : }
32 :
33 : nsresult init(const nsAString& aQName, txNamespaceMap* aResolver,
34 : bool aUseDefault);
35 :
36 0 : void reset()
37 : {
38 0 : mNamespaceID = kNameSpaceID_None;
39 0 : mLocalName = nullptr;
40 0 : }
41 :
42 0 : bool isNull()
43 : {
44 0 : return mNamespaceID == kNameSpaceID_None && !mLocalName;
45 : }
46 :
47 : txExpandedName& operator = (const txExpandedName& rhs)
48 : {
49 : mNamespaceID = rhs.mNamespaceID;
50 : mLocalName = rhs.mLocalName;
51 : return *this;
52 : }
53 :
54 0 : bool operator == (const txExpandedName& rhs) const
55 : {
56 0 : return ((mLocalName == rhs.mLocalName) &&
57 0 : (mNamespaceID == rhs.mNamespaceID));
58 : }
59 :
60 : bool operator != (const txExpandedName& rhs) const
61 : {
62 : return ((mLocalName != rhs.mLocalName) ||
63 : (mNamespaceID != rhs.mNamespaceID));
64 : }
65 :
66 : int32_t mNamespaceID;
67 : nsCOMPtr<nsIAtom> mLocalName;
68 : };
69 :
70 : #endif
|