[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / Description.cs
1 using org.ldk.impl;
2 using org.ldk.enums;
3 using org.ldk.util;
4 using System;
5
6 namespace org { namespace ldk { namespace structs {
7
8
9 /**
10  * Description string
11  * 
12  * # Invariants
13  * The description can be at most 639 __bytes__ long
14  */
15 public class Description : CommonBase {
16         internal Description(object _dummy, long ptr) : base(ptr) { }
17         ~Description() {
18                 if (ptr != 0) { bindings.Description_free(ptr); }
19         }
20
21         internal long clone_ptr() {
22                 long ret = bindings.Description_clone_ptr(this.ptr);
23                 GC.KeepAlive(this);
24                 return ret;
25         }
26
27         /**
28          * Creates a copy of the Description
29          */
30         public Description clone() {
31                 long ret = bindings.Description_clone(this.ptr);
32                 GC.KeepAlive(this);
33                 if (ret >= 0 && ret <= 4096) { return null; }
34                 org.ldk.structs.Description ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Description(null, ret); }
35                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
36                 return ret_hu_conv;
37         }
38
39         /**
40          * Generates a non-cryptographic 64-bit hash of the Description.
41          */
42         public long hash() {
43                 long ret = bindings.Description_hash(this.ptr);
44                 GC.KeepAlive(this);
45                 return ret;
46         }
47
48         public override int GetHashCode() {
49                 return (int)this.hash();
50         }
51         /**
52          * Checks if two Descriptions contain equal inner contents.
53          * This ignores pointers and is_owned flags and looks at the values in fields.
54          * Two objects with NULL inner values will be considered "equal" here.
55          */
56         public bool eq(org.ldk.structs.Description b) {
57                 bool ret = bindings.Description_eq(this.ptr, b == null ? 0 : b.ptr);
58                 GC.KeepAlive(this);
59                 GC.KeepAlive(b);
60                 if (this != null) { this.ptrs_to.AddLast(b); };
61                 return ret;
62         }
63
64         public override bool Equals(object o) {
65                 if (!(o is Description)) return false;
66                 return this.eq((Description)o);
67         }
68         /**
69          * Creates a new `Description` if `description` is at most 1023 __bytes__ long,
70          * returns [`CreationError::DescriptionTooLong`] otherwise
71          * 
72          * Please note that single characters may use more than one byte due to UTF8 encoding.
73          */
74         public static Result_DescriptionCreationErrorZ of(string description) {
75                 long ret = bindings.Description_new(InternalUtils.encodeString(description));
76                 GC.KeepAlive(description);
77                 if (ret >= 0 && ret <= 4096) { return null; }
78                 Result_DescriptionCreationErrorZ ret_hu_conv = Result_DescriptionCreationErrorZ.constr_from_ptr(ret);
79                 return ret_hu_conv;
80         }
81
82         /**
83          * Returns the underlying description [`UntrustedString`]
84          */
85         public UntrustedString into_inner() {
86                 long ret = bindings.Description_into_inner(this.ptr);
87                 GC.KeepAlive(this);
88                 if (ret >= 0 && ret <= 4096) { return null; }
89                 org.ldk.structs.UntrustedString ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UntrustedString(null, ret); }
90                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
91                 if (this != null) { this.ptrs_to.AddLast(this); };
92                 return ret_hu_conv;
93         }
94
95         /**
96          * Get the string representation of a Description object
97          */
98         public string to_str() {
99                 long ret = bindings.Description_to_str(this.ptr);
100                 GC.KeepAlive(this);
101                 if (ret >= 0 && ret <= 4096) { return null; }
102                 string ret_conv = InternalUtils.decodeString(ret);
103                 return ret_conv;
104         }
105
106 }
107 } } }