2 * Copyright(c) 2022 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 using System.Diagnostics;
19 namespace Tizen.NUI.Xaml
21 [DebuggerDisplay("{NamespaceURI}:{LocalName}")]
22 internal struct XmlName
24 public static readonly XmlName _CreateContent = new XmlName("_", "CreateContent");
25 public static readonly XmlName xKey = new XmlName("x", "Key");
26 public static readonly XmlName xName = new XmlName("x", "Name");
27 public static readonly XmlName xTypeArguments = new XmlName("x", "TypeArguments");
28 public static readonly XmlName xArguments = new XmlName("x", "Arguments");
29 public static readonly XmlName xFactoryMethod = new XmlName("x", "FactoryMethod");
30 public static readonly XmlName xDataType = new XmlName("x", "DataType");
31 public static readonly XmlName Empty = new XmlName();
33 public string NamespaceURI { get; }
34 public string LocalName { get; }
36 public XmlName(string namespaceUri, string localName)
38 NamespaceURI = namespaceUri;
39 LocalName = localName;
42 public override bool Equals(object obj)
46 if (obj.GetType() != typeof (XmlName))
48 var other = (XmlName)obj;
49 return NamespaceURI == other.NamespaceURI && LocalName == other.LocalName;
52 public bool Equals(string namespaceUri, string localName)
53 => Equals(new XmlName(namespaceUri, localName));
55 public override int GetHashCode()
60 if (NamespaceURI != null)
61 hashCode = NamespaceURI.GetHashCode();
62 if (LocalName != null)
63 hashCode = (hashCode * 397) ^ LocalName.GetHashCode();
68 public static bool operator ==(XmlName x1, XmlName x2)
69 => x1.NamespaceURI == x2.NamespaceURI && x1.LocalName == x2.LocalName;
71 public static bool operator !=(XmlName x1, XmlName x2)