BadScript 2
Loading...
Searching...
No Matches
BadString.cs
Go to the documentation of this file.
2
4
8public class BadString : BadNative<string>, IBadString, IComparable, IComparable<BadObject>, IComparable<IBadString>
9{
13 private static readonly BadClassPrototype s_Prototype = BadNativeClassBuilder.GetNative("string");
14
15 public static readonly BadString Empty = new BadString(string.Empty);
16
21 public BadString(string value) : base(value) { }
22
23#region IBadString Members
24
28 string IBadString.Value => Value;
29
30#endregion
31
32#region IComparable Members
33
40 public int CompareTo(object obj)
41 {
42 if (obj is BadObject o)
43 {
44 return CompareTo(o);
45 }
46
47 throw new Exception("Cannot compare string to non string");
48 }
49
50#endregion
51
52#region IComparable<BadObject> Members
53
60 public int CompareTo(BadObject other)
61 {
62 if (other is IBadString str)
63 {
64 return CompareTo(str);
65 }
66
67 throw new Exception("Cannot compare string to non string");
68 }
69
70#endregion
71
72#region IComparable<IBadString> Members
73
79 public int CompareTo(IBadString other)
80 {
81 return string.Compare(Value, other.Value, StringComparison.Ordinal);
82 }
83
84#endregion
85
88 {
89 return s_Prototype;
90 }
91}
The Base Class for all BadScript Objects.
Definition BadObject.cs:14
Implements a Native String.
Definition BadString.cs:9
static readonly BadClassPrototype s_Prototype
The Prototype for the Native String Object.
Definition BadString.cs:13
int CompareTo(BadObject other)
Compares this String to another String.
Definition BadString.cs:60
int CompareTo(IBadString other)
Compares this String to another String.
Definition BadString.cs:79
override BadClassPrototype GetPrototype()
Definition BadString.cs:87
int CompareTo(object obj)
Compares this String to another String.
Definition BadString.cs:40
BadString(string value)
Creates a new Native String.
Definition BadString.cs:21
string IBadString. Value
The Value of the Native String.
Definition BadString.cs:28
Implements a Class Prototype for the BadScript Language.
Helper Class that Builds a Native Class from a Prototype.
static BadClassPrototype GetNative(string name)
Returns a Native Class Prototype for the given Native Type.
Implements the Interface for Native Strings.
Definition IBadString.cs:7
new string Value
The String Value.
Definition IBadString.cs:11
Contains the Native Runtime Objects.
Definition BadBoolean.cs:6