]> git.bitcoin.ninja Git - ldk-java/blob - c_sharp/src/org/ldk/structs/OfferFeatures.cs
6ce10456eb99b565c2282be247932dabe9537bc2
[ldk-java] / c_sharp / src / org / ldk / structs / OfferFeatures.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 `offer`.
11  */
12 public class OfferFeatures : CommonBase {
13         internal OfferFeatures(object _dummy, long ptr) : base(ptr) { }
14         ~OfferFeatures() {
15                 if (ptr != 0) { bindings.OfferFeatures_free(ptr); }
16         }
17
18         /**
19          * Checks if two OfferFeaturess 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.OfferFeatures b) {
24                 bool ret = bindings.OfferFeatures_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 OfferFeatures)) return false;
33                 return this.eq((OfferFeatures)o);
34         }
35         internal long clone_ptr() {
36                 long ret = bindings.OfferFeatures_clone_ptr(this.ptr);
37                 GC.KeepAlive(this);
38                 return ret;
39         }
40
41         /**
42          * Creates a copy of the OfferFeatures
43          */
44         public OfferFeatures clone() {
45                 long ret = bindings.OfferFeatures_clone(this.ptr);
46                 GC.KeepAlive(this);
47                 if (ret >= 0 && ret <= 4096) { return null; }
48                 org.ldk.structs.OfferFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OfferFeatures(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 OfferFeatures empty() {
57                 long ret = bindings.OfferFeatures_empty();
58                 if (ret >= 0 && ret <= 4096) { return null; }
59                 org.ldk.structs.OfferFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OfferFeatures(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 required features unknown by `other`.
66          */
67         public bool requires_unknown_bits_from(org.ldk.structs.OfferFeatures other) {
68                 bool ret = bindings.OfferFeatures_requires_unknown_bits_from(this.ptr, other == null ? 0 : other.ptr);
69                 GC.KeepAlive(this);
70                 GC.KeepAlive(other);
71                 if (this != null) { this.ptrs_to.AddLast(other); };
72                 return ret;
73         }
74
75         /**
76          * Returns true if this `Features` object contains unknown feature flags which are set as
77          * \"required\".
78          */
79         public bool requires_unknown_bits() {
80                 bool ret = bindings.OfferFeatures_requires_unknown_bits(this.ptr);
81                 GC.KeepAlive(this);
82                 return ret;
83         }
84
85         /**
86          * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined
87          * by [bLIP 2] or if it is a known `T` feature.
88          * 
89          * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will
90          * be set instead (i.e., `bit - 1`).
91          * 
92          * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
93          */
94         public Result_NoneNoneZ set_required_custom_bit(long bit) {
95                 long ret = bindings.OfferFeatures_set_required_custom_bit(this.ptr, bit);
96                 GC.KeepAlive(this);
97                 GC.KeepAlive(bit);
98                 if (ret >= 0 && ret <= 4096) { return null; }
99                 Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret);
100                 return ret_hu_conv;
101         }
102
103         /**
104          * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined
105          * by [bLIP 2] or if it is a known `T` feature.
106          * 
107          * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be
108          * set instead (i.e., `bit + 1`).
109          * 
110          * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
111          */
112         public Result_NoneNoneZ set_optional_custom_bit(long bit) {
113                 long ret = bindings.OfferFeatures_set_optional_custom_bit(this.ptr, bit);
114                 GC.KeepAlive(this);
115                 GC.KeepAlive(bit);
116                 if (ret >= 0 && ret <= 4096) { return null; }
117                 Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret);
118                 return ret_hu_conv;
119         }
120
121 }
122 } } }