(DISTFILES): Comment out a few missing files.
[mono-project.git] / mcs / class / Mono.Data.SybaseClient / Mono.Data.SybaseTypes / SybaseGuid.cs
blobf8290e22b988bedccb5940a629c97ae38a59ee00
1 //
2 // Mono.Data.SybaseTypes.SybaseGuid
3 //
4 // Author:
5 // Tim Coleman <tim@timcoleman.com>
6 //
7 // (C) Copyright Tim Coleman, 2002
8 //
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
18 //
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
21 //
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 using Mono.Data.SybaseClient;
32 using System;
33 using System.Data.SqlTypes;
34 using System.Globalization;
36 namespace Mono.Data.SybaseTypes {
37 public struct SybaseGuid : INullable, IComparable
39 #region Fields
41 Guid value;
43 private bool notNull;
45 public static readonly SybaseGuid Null;
47 #endregion
49 #region Constructors
51 public SybaseGuid (byte[] value)
53 this.value = new Guid (value);
54 notNull = true;
57 public SybaseGuid (Guid g)
59 this.value = g;
60 notNull = true;
63 public SybaseGuid (string s)
65 this.value = new Guid (s);
66 notNull = true;
69 public SybaseGuid (int a, short b, short c, byte d, byte e, byte f, byte g, byte h, byte i, byte j, byte k)
71 this.value = new Guid (a, b, c, d, e, f, g, h, i, j, k);
72 notNull = true;
75 #endregion
77 #region Properties
79 public bool IsNull {
80 get { return !notNull; }
83 public Guid Value {
84 get {
85 if (this.IsNull)
86 throw new SybaseNullValueException ("The property contains Null.");
87 else
88 return value;
92 #endregion
94 #region Methods
96 public int CompareTo (object value)
98 if (value == null)
99 return 1;
100 else if (!(value is SybaseGuid))
101 throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SybaseTypes.SybaseGuid"));
102 else if (((SybaseGuid)value).IsNull)
103 return 1;
104 else
105 return this.value.CompareTo (((SybaseGuid)value).Value);
108 public override bool Equals (object value)
110 if (!(value is SybaseGuid))
111 return false;
112 else
113 return (bool) (this == (SybaseGuid)value);
116 public static SybaseBoolean Equals (SybaseGuid x, SybaseGuid y)
118 return (x == y);
121 [MonoTODO]
122 public override int GetHashCode ()
124 return 42;
127 public static SybaseBoolean GreaterThan (SybaseGuid x, SybaseGuid y)
129 return (x > y);
132 public static SybaseBoolean GreaterThanOrEqual (SybaseGuid x, SybaseGuid y)
134 return (x >= y);
137 public static SybaseBoolean LessThan (SybaseGuid x, SybaseGuid y)
139 return (x < y);
142 public static SybaseBoolean LessThanOrEqual (SybaseGuid x, SybaseGuid y)
144 return (x <= y);
147 public static SybaseBoolean NotEquals (SybaseGuid x, SybaseGuid y)
149 return (x != y);
152 [MonoTODO]
153 public static SybaseGuid Parse (string s)
155 throw new NotImplementedException ();
158 [MonoTODO]
159 public byte[] ToByteArray()
161 throw new NotImplementedException ();
164 public SybaseBinary ToSybaseBinary ()
166 return ((SybaseBinary)this);
169 public SybaseString ToSybaseString ()
171 return ((SybaseString)this);
174 public override string ToString ()
176 if (this.IsNull)
177 return String.Empty;
178 else
179 return value.ToString ();
182 public static SybaseBoolean operator == (SybaseGuid x, SybaseGuid y)
184 if (x.IsNull || y.IsNull) return SybaseBoolean.Null;
185 return new SybaseBoolean (x.Value == y.Value);
188 [MonoTODO]
189 public static SybaseBoolean operator > (SybaseGuid x, SybaseGuid y)
191 throw new NotImplementedException ();
194 [MonoTODO]
195 public static SybaseBoolean operator >= (SybaseGuid x, SybaseGuid y)
197 throw new NotImplementedException ();
200 public static SybaseBoolean operator != (SybaseGuid x, SybaseGuid y)
202 if (x.IsNull || y.IsNull) return SybaseBoolean.Null;
203 return new SybaseBoolean (!(x.Value == y.Value));
206 [MonoTODO]
207 public static SybaseBoolean operator < (SybaseGuid x, SybaseGuid y)
209 throw new NotImplementedException ();
212 [MonoTODO]
213 public static SybaseBoolean operator <= (SybaseGuid x, SybaseGuid y)
215 throw new NotImplementedException ();
218 [MonoTODO]
219 public static explicit operator SybaseGuid (SybaseBinary x)
221 throw new NotImplementedException ();
224 public static explicit operator Guid (SybaseGuid x)
226 return x.Value;
229 [MonoTODO]
230 public static explicit operator SybaseGuid (SybaseString x)
232 throw new NotImplementedException ();
235 public static implicit operator SybaseGuid (Guid x)
237 return new SybaseGuid (x);
240 #endregion