2 // Mono.Data.SybaseTypes.SybaseGuid
5 // Tim Coleman <tim@timcoleman.com>
7 // (C) Copyright Tim Coleman, 2002
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:
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
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
;
33 using System
.Data
.SqlTypes
;
34 using System
.Globalization
;
36 namespace Mono
.Data
.SybaseTypes
{
37 public struct SybaseGuid
: INullable
, IComparable
45 public static readonly SybaseGuid Null
;
51 public SybaseGuid (byte[] value)
53 this.value = new Guid (value);
57 public SybaseGuid (Guid g
)
63 public SybaseGuid (string s
)
65 this.value = new Guid (s
);
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
);
80 get { return !notNull; }
86 throw new SybaseNullValueException ("The property contains Null.");
96 public int CompareTo (object value)
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
)
105 return this.value.CompareTo (((SybaseGuid
)value).Value
);
108 public override bool Equals (object value)
110 if (!(value is SybaseGuid
))
113 return (bool) (this == (SybaseGuid
)value);
116 public static SybaseBoolean
Equals (SybaseGuid x
, SybaseGuid y
)
122 public override int GetHashCode ()
127 public static SybaseBoolean
GreaterThan (SybaseGuid x
, SybaseGuid y
)
132 public static SybaseBoolean
GreaterThanOrEqual (SybaseGuid x
, SybaseGuid y
)
137 public static SybaseBoolean
LessThan (SybaseGuid x
, SybaseGuid y
)
142 public static SybaseBoolean
LessThanOrEqual (SybaseGuid x
, SybaseGuid y
)
147 public static SybaseBoolean
NotEquals (SybaseGuid x
, SybaseGuid y
)
153 public static SybaseGuid
Parse (string s
)
155 throw new NotImplementedException ();
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 ()
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
);
189 public static SybaseBoolean
operator > (SybaseGuid x
, SybaseGuid y
)
191 throw new NotImplementedException ();
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
));
207 public static SybaseBoolean
operator < (SybaseGuid x
, SybaseGuid y
)
209 throw new NotImplementedException ();
213 public static SybaseBoolean
operator <= (SybaseGuid x
, SybaseGuid y
)
215 throw new NotImplementedException ();
219 public static explicit operator SybaseGuid (SybaseBinary x
)
221 throw new NotImplementedException ();
224 public static explicit operator Guid (SybaseGuid x
)
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
);