[C#] Add marshaling logic for array C# -> C conversion
[ldk-java] / c_sharp / src / org / ldk / structs / InvoiceFeatures.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  * Features used within an invoice.
11  */
12 public class InvoiceFeatures : CommonBase {
13         internal InvoiceFeatures(object _dummy, long ptr) : base(ptr) { }
14         ~InvoiceFeatures() {
15                 if (ptr != 0) { bindings.InvoiceFeatures_free(ptr); }
16         }
17
18         /**
19          * Checks if two InvoiceFeaturess contain equal inner contents.
20          * This ignores pointers and is_owned flags and looks at the values in fields.
21          * Two objects with NULL inner values will be considered "equal" here.
22          */
23         public bool eq(org.ldk.structs.InvoiceFeatures b) {
24                 bool ret = bindings.InvoiceFeatures_eq(this.ptr, b == null ? 0 : b.ptr);
25                 GC.KeepAlive(this);
26                 GC.KeepAlive(b);
27                 if (this != null) { this.ptrs_to.AddLast(b); };
28                 return ret;
29         }
30
31         public override bool Equals(object o) {
32                 if (!(o is InvoiceFeatures)) return false;
33                 return this.eq((InvoiceFeatures)o);
34         }
35         internal long clone_ptr() {
36                 long ret = bindings.InvoiceFeatures_clone_ptr(this.ptr);
37                 GC.KeepAlive(this);
38                 return ret;
39         }
40
41         /**
42          * Creates a copy of the InvoiceFeatures
43          */
44         public InvoiceFeatures clone() {
45                 long ret = bindings.InvoiceFeatures_clone(this.ptr);
46                 GC.KeepAlive(this);
47                 if (ret >= 0 && ret <= 4096) { return null; }
48                 org.ldk.structs.InvoiceFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InvoiceFeatures(null, ret); }
49                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
50                 return ret_hu_conv;
51         }
52
53         /**
54          * Create a blank Features with no features set
55          */
56         public static InvoiceFeatures empty() {
57                 long ret = bindings.InvoiceFeatures_empty();
58                 if (ret >= 0 && ret <= 4096) { return null; }
59                 org.ldk.structs.InvoiceFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InvoiceFeatures(null, ret); }
60                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
61                 return ret_hu_conv;
62         }
63
64         /**
65          * Returns true if this `Features` object contains unknown feature flags which are set as
66          * \"required\".
67          */
68         public bool requires_unknown_bits() {
69                 bool ret = bindings.InvoiceFeatures_requires_unknown_bits(this.ptr);
70                 GC.KeepAlive(this);
71                 return ret;
72         }
73
74         /**
75          * Serialize the InvoiceFeatures object into a byte array which can be read by InvoiceFeatures_read
76          */
77         public byte[] write() {
78                 byte[] ret = bindings.InvoiceFeatures_write(this.ptr);
79                 GC.KeepAlive(this);
80                 return ret;
81         }
82
83         /**
84          * Read a InvoiceFeatures from a byte array, created by InvoiceFeatures_write
85          */
86         public static Result_InvoiceFeaturesDecodeErrorZ read(byte[] ser) {
87                 long ret = bindings.InvoiceFeatures_read(ser);
88                 GC.KeepAlive(ser);
89                 if (ret >= 0 && ret <= 4096) { return null; }
90                 Result_InvoiceFeaturesDecodeErrorZ ret_hu_conv = Result_InvoiceFeaturesDecodeErrorZ.constr_from_ptr(ret);
91                 return ret_hu_conv;
92         }
93
94         /**
95          * Set this feature as optional.
96          */
97         public void set_variable_length_onion_optional() {
98                 bindings.InvoiceFeatures_set_variable_length_onion_optional(this.ptr);
99                 GC.KeepAlive(this);
100         }
101
102         /**
103          * Set this feature as required.
104          */
105         public void set_variable_length_onion_required() {
106                 bindings.InvoiceFeatures_set_variable_length_onion_required(this.ptr);
107                 GC.KeepAlive(this);
108         }
109
110         /**
111          * Checks if this feature is supported.
112          */
113         public bool supports_variable_length_onion() {
114                 bool ret = bindings.InvoiceFeatures_supports_variable_length_onion(this.ptr);
115                 GC.KeepAlive(this);
116                 return ret;
117         }
118
119         /**
120          * Checks if this feature is required.
121          */
122         public bool requires_variable_length_onion() {
123                 bool ret = bindings.InvoiceFeatures_requires_variable_length_onion(this.ptr);
124                 GC.KeepAlive(this);
125                 return ret;
126         }
127
128         /**
129          * Set this feature as optional.
130          */
131         public void set_payment_secret_optional() {
132                 bindings.InvoiceFeatures_set_payment_secret_optional(this.ptr);
133                 GC.KeepAlive(this);
134         }
135
136         /**
137          * Set this feature as required.
138          */
139         public void set_payment_secret_required() {
140                 bindings.InvoiceFeatures_set_payment_secret_required(this.ptr);
141                 GC.KeepAlive(this);
142         }
143
144         /**
145          * Checks if this feature is supported.
146          */
147         public bool supports_payment_secret() {
148                 bool ret = bindings.InvoiceFeatures_supports_payment_secret(this.ptr);
149                 GC.KeepAlive(this);
150                 return ret;
151         }
152
153         /**
154          * Checks if this feature is required.
155          */
156         public bool requires_payment_secret() {
157                 bool ret = bindings.InvoiceFeatures_requires_payment_secret(this.ptr);
158                 GC.KeepAlive(this);
159                 return ret;
160         }
161
162         /**
163          * Set this feature as optional.
164          */
165         public void set_basic_mpp_optional() {
166                 bindings.InvoiceFeatures_set_basic_mpp_optional(this.ptr);
167                 GC.KeepAlive(this);
168         }
169
170         /**
171          * Set this feature as required.
172          */
173         public void set_basic_mpp_required() {
174                 bindings.InvoiceFeatures_set_basic_mpp_required(this.ptr);
175                 GC.KeepAlive(this);
176         }
177
178         /**
179          * Checks if this feature is supported.
180          */
181         public bool supports_basic_mpp() {
182                 bool ret = bindings.InvoiceFeatures_supports_basic_mpp(this.ptr);
183                 GC.KeepAlive(this);
184                 return ret;
185         }
186
187         /**
188          * Checks if this feature is required.
189          */
190         public bool requires_basic_mpp() {
191                 bool ret = bindings.InvoiceFeatures_requires_basic_mpp(this.ptr);
192                 GC.KeepAlive(this);
193                 return ret;
194         }
195
196 }
197 } } }