[TS] Update auto-generated bindings to LDK-C-Bindings 0.0.123.1
[ldk-java] / c_sharp / src / org / ldk / structs / Quantity.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  * Quantity of items supported by an [`Offer`].
10  */
11 public class Quantity : CommonBase {
12         protected Quantity(object _dummy, long ptr) : base(ptr) { }
13         ~Quantity() {
14                 if (ptr != 0) { bindings.Quantity_free(ptr); }
15         }
16
17         internal static Quantity constr_from_ptr(long ptr) {
18                 long raw_ty = bindings.LDKQuantity_ty_from_ptr(ptr);
19                 switch (raw_ty) {
20                         case 0: return new Quantity_Bounded(ptr);
21                         case 1: return new Quantity_Unbounded(ptr);
22                         case 2: return new Quantity_One(ptr);
23                         default:
24                                 throw new ArgumentException("Impossible enum variant");
25                 }
26         }
27
28         /** A Quantity of type Bounded */
29         public class Quantity_Bounded : Quantity {
30                 public long bounded;
31                 internal Quantity_Bounded(long ptr) : base(null, ptr) {
32                         this.bounded = bindings.LDKQuantity_Bounded_get_bounded(ptr);
33                 }
34         }
35         /** A Quantity of type Unbounded */
36         public class Quantity_Unbounded : Quantity {
37                 internal Quantity_Unbounded(long ptr) : base(null, ptr) {
38                 }
39         }
40         /** A Quantity of type One */
41         public class Quantity_One : Quantity {
42                 internal Quantity_One(long ptr) : base(null, ptr) {
43                 }
44         }
45         internal long clone_ptr() {
46                 long ret = bindings.Quantity_clone_ptr(this.ptr);
47                 GC.KeepAlive(this);
48                 return ret;
49         }
50
51         /**
52          * Creates a copy of the Quantity
53          */
54         public Quantity clone() {
55                 long ret = bindings.Quantity_clone(this.ptr);
56                 GC.KeepAlive(this);
57                 if (ret >= 0 && ret <= 4096) { return null; }
58                 org.ldk.structs.Quantity ret_hu_conv = org.ldk.structs.Quantity.constr_from_ptr(ret);
59                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
60                 return ret_hu_conv;
61         }
62
63         /**
64          * Utility method to constructs a new Bounded-variant Quantity
65          */
66         public static Quantity bounded(long a) {
67                 long ret = bindings.Quantity_bounded(a);
68                 GC.KeepAlive(a);
69                 if (ret >= 0 && ret <= 4096) { return null; }
70                 org.ldk.structs.Quantity ret_hu_conv = org.ldk.structs.Quantity.constr_from_ptr(ret);
71                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
72                 return ret_hu_conv;
73         }
74
75         /**
76          * Utility method to constructs a new Unbounded-variant Quantity
77          */
78         public static Quantity unbounded() {
79                 long ret = bindings.Quantity_unbounded();
80                 if (ret >= 0 && ret <= 4096) { return null; }
81                 org.ldk.structs.Quantity ret_hu_conv = org.ldk.structs.Quantity.constr_from_ptr(ret);
82                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
83                 return ret_hu_conv;
84         }
85
86         /**
87          * Utility method to constructs a new One-variant Quantity
88          */
89         public static Quantity one() {
90                 long ret = bindings.Quantity_one();
91                 if (ret >= 0 && ret <= 4096) { return null; }
92                 org.ldk.structs.Quantity ret_hu_conv = org.ldk.structs.Quantity.constr_from_ptr(ret);
93                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
94                 return ret_hu_conv;
95         }
96
97 }
98 } } }