1
/* Copyright (c) 2006 Google Inc.
3
* Licensed under the Apache License, Version 2.0 (the "License");
4
* you may not use this file except in compliance with the License.
5
* You may obtain a copy of the License at
7
* http://www.apache.org/licenses/LICENSE-2.0
9
* Unless required by applicable law or agreed to in writing, software
10
* distributed under the License is distributed on an "AS IS" BASIS,
11
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
* See the License for the specific language governing permissions and
13
* limitations under the License.
15
#region Using directives
21
using System.Globalization;
22
using System.ComponentModel;
27
//////////////////////////////////////////////////////////////////////
29
//////////////////////////////////////////////////////////////////////
30
namespace Google.GData.Client
32
//////////////////////////////////////////////////////////////////////
33
/// <summary>The "atom:id" element conveys a permanent, universally unique identifier for an entry or feed.
35
//////////////////////////////////////////////////////////////////////
36
#if WindowsCE || PocketPC
38
[TypeConverterAttribute(typeof(AtomBaseLinkConverter)), DescriptionAttribute("Expand to see the link attributes for the Id.")]
40
public class AtomId : AtomBaseLink, IComparable
43
//////////////////////////////////////////////////////////////////////
44
/// <summary>empty constructor</summary>
45
//////////////////////////////////////////////////////////////////////
46
public AtomId() : base()
49
/////////////////////////////////////////////////////////////////////////////
52
//////////////////////////////////////////////////////////////////////
53
/// <summary>public AtomId(string uri)</summary>
54
/// <param name="link">the URI for the ID</param>
55
/// <returns> </returns>
56
//////////////////////////////////////////////////////////////////////
57
public AtomId(string link) : base()
59
this.Uri = new AtomUri(link);
61
/////////////////////////////////////////////////////////////////////////////
64
#region Persistence overloads
65
//////////////////////////////////////////////////////////////////////
66
/// <summary>Returns the constant representing this XML element.</summary>
67
//////////////////////////////////////////////////////////////////////
68
public override string XmlName
70
get { return AtomParserNameTable.XmlIdElement; }
72
/////////////////////////////////////////////////////////////////////////////
75
#region IComparable Members
78
/// as we do comparisons, we need to override this
79
/// we return the hashcode of our string member
81
/// <returns>int</returns>
82
public override int GetHashCode()
84
return this.Uri.GetHashCode();
89
/// overloaded IComparable interface method
91
/// <param name="obj">the object to compare this instance with</param>
92
/// <returns>int</returns>
93
public int CompareTo(object obj)
95
AtomId other = obj as AtomId;
100
if (this.Uri != null)
101
return this.Uri.CompareTo(other.Uri);
103
if (other.Uri == null)
112
/// overridden equal method
114
/// <param name="obj"></param>
115
/// <returns>bool</returns>
116
public override bool Equals(object obj)
118
return this.CompareTo(obj) == 0;
122
/// overridden comparson operator
124
/// <param name="a"></param>
125
/// <param name="b"></param>
126
/// <returns>bool</returns>
127
public static bool operator ==(AtomId a, AtomId b)
129
if ((object)a == null && (object)b == null) return true;
130
if ((object)a != null && (object)b != null)
138
/// overridden comparson operator
140
/// <param name="a"></param>
141
/// <param name="b"></param>
142
/// <returns>bool</returns>
143
public static bool operator !=(AtomId a, AtomId b)
150
/////////////////////////////////////////////////////////////////////////////
152
/////////////////////////////////////////////////////////////////////////////