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
26 string IBadString.Value => Value;
27
34 public int CompareTo(object obj)
35 {
36 if (obj is BadObject o)
37 {
38 return CompareTo(o);
39 }
40
41 throw new Exception("Cannot compare string to non string");
42 }
43
50 public int CompareTo(BadObject other)
51 {
52 if (other is IBadString str)
53 {
54 return CompareTo(str);
55 }
56
57 throw new Exception("Cannot compare string to non string");
58 }
59
65 public int CompareTo(IBadString other)
66 {
67 return string.Compare(Value, other.Value, StringComparison.Ordinal);
68 }
69
72 {
73 return s_Prototype;
74 }
75}
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:50
int CompareTo(IBadString other)
Compares this String to another String.
Definition BadString.cs:65
override BadClassPrototype GetPrototype()
Definition BadString.cs:71
int CompareTo(object obj)
Compares this String to another String.
Definition BadString.cs:34
BadString(string value)
Creates a new Native String.
Definition BadString.cs:21
string IBadString. Value
The Value of the Native String.
Definition BadString.cs:26
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