txExpandedName.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. #ifndef TRANSFRMX_EXPANDEDNAME_H
  6. #define TRANSFRMX_EXPANDEDNAME_H
  7. #include "nsCOMPtr.h"
  8. #include "nsIAtom.h"
  9. #include "mozilla/dom/NameSpaceConstants.h"
  10. class txNamespaceMap;
  11. class txExpandedName {
  12. public:
  13. txExpandedName() : mNamespaceID(kNameSpaceID_None)
  14. {
  15. }
  16. txExpandedName(int32_t aNsID,
  17. nsIAtom* aLocalName) : mNamespaceID(aNsID),
  18. mLocalName(aLocalName)
  19. {
  20. }
  21. txExpandedName(const txExpandedName& aOther) :
  22. mNamespaceID(aOther.mNamespaceID),
  23. mLocalName(aOther.mLocalName)
  24. {
  25. }
  26. nsresult init(const nsAString& aQName, txNamespaceMap* aResolver,
  27. bool aUseDefault);
  28. void reset()
  29. {
  30. mNamespaceID = kNameSpaceID_None;
  31. mLocalName = nullptr;
  32. }
  33. bool isNull()
  34. {
  35. return mNamespaceID == kNameSpaceID_None && !mLocalName;
  36. }
  37. txExpandedName& operator = (const txExpandedName& rhs)
  38. {
  39. mNamespaceID = rhs.mNamespaceID;
  40. mLocalName = rhs.mLocalName;
  41. return *this;
  42. }
  43. bool operator == (const txExpandedName& rhs) const
  44. {
  45. return ((mLocalName == rhs.mLocalName) &&
  46. (mNamespaceID == rhs.mNamespaceID));
  47. }
  48. bool operator != (const txExpandedName& rhs) const
  49. {
  50. return ((mLocalName != rhs.mLocalName) ||
  51. (mNamespaceID != rhs.mNamespaceID));
  52. }
  53. int32_t mNamespaceID;
  54. nsCOMPtr<nsIAtom> mLocalName;
  55. };
  56. #endif