[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / ParseOrSemanticError.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  * Indicates that something went wrong while parsing or validating the invoice. Parsing errors
10  * should be mostly seen as opaque and are only there for debugging reasons. Semantic errors
11  * like wrong signatures, missing fields etc. could mean that someone tampered with the invoice.
12  */
13 public class ParseOrSemanticError : CommonBase {
14         protected ParseOrSemanticError(object _dummy, long ptr) : base(ptr) { }
15         ~ParseOrSemanticError() {
16                 if (ptr != 0) { bindings.ParseOrSemanticError_free(ptr); }
17         }
18
19         internal static ParseOrSemanticError constr_from_ptr(long ptr) {
20                 long raw_ty = bindings.LDKParseOrSemanticError_ty_from_ptr(ptr);
21                 switch (raw_ty) {
22                         case 0: return new ParseOrSemanticError_ParseError(ptr);
23                         case 1: return new ParseOrSemanticError_SemanticError(ptr);
24                         default:
25                                 throw new ArgumentException("Impossible enum variant");
26                 }
27         }
28
29         /** A ParseOrSemanticError of type ParseError */
30         public class ParseOrSemanticError_ParseError : ParseOrSemanticError {
31                 public Bolt11ParseError parse_error;
32                 internal ParseOrSemanticError_ParseError(long ptr) : base(null, ptr) {
33                         long parse_error = bindings.LDKParseOrSemanticError_ParseError_get_parse_error(ptr);
34                         org.ldk.structs.Bolt11ParseError parse_error_hu_conv = org.ldk.structs.Bolt11ParseError.constr_from_ptr(parse_error);
35                         if (parse_error_hu_conv != null) { parse_error_hu_conv.ptrs_to.AddLast(this); };
36                         this.parse_error = parse_error_hu_conv;
37                 }
38         }
39         /** A ParseOrSemanticError of type SemanticError */
40         public class ParseOrSemanticError_SemanticError : ParseOrSemanticError {
41                 public Bolt11SemanticError semantic_error;
42                 internal ParseOrSemanticError_SemanticError(long ptr) : base(null, ptr) {
43                         this.semantic_error = bindings.LDKParseOrSemanticError_SemanticError_get_semantic_error(ptr);
44                 }
45         }
46         internal long clone_ptr() {
47                 long ret = bindings.ParseOrSemanticError_clone_ptr(this.ptr);
48                 GC.KeepAlive(this);
49                 return ret;
50         }
51
52         /**
53          * Creates a copy of the ParseOrSemanticError
54          */
55         public ParseOrSemanticError clone() {
56                 long ret = bindings.ParseOrSemanticError_clone(this.ptr);
57                 GC.KeepAlive(this);
58                 if (ret >= 0 && ret <= 4096) { return null; }
59                 org.ldk.structs.ParseOrSemanticError ret_hu_conv = org.ldk.structs.ParseOrSemanticError.constr_from_ptr(ret);
60                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
61                 return ret_hu_conv;
62         }
63
64         /**
65          * Utility method to constructs a new ParseError-variant ParseOrSemanticError
66          */
67         public static ParseOrSemanticError parse_error(org.ldk.structs.Bolt11ParseError a) {
68                 long ret = bindings.ParseOrSemanticError_parse_error(a.ptr);
69                 GC.KeepAlive(a);
70                 if (ret >= 0 && ret <= 4096) { return null; }
71                 org.ldk.structs.ParseOrSemanticError ret_hu_conv = org.ldk.structs.ParseOrSemanticError.constr_from_ptr(ret);
72                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
73                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(a); };
74                 return ret_hu_conv;
75         }
76
77         /**
78          * Utility method to constructs a new SemanticError-variant ParseOrSemanticError
79          */
80         public static ParseOrSemanticError semantic_error(Bolt11SemanticError a) {
81                 long ret = bindings.ParseOrSemanticError_semantic_error(a);
82                 GC.KeepAlive(a);
83                 if (ret >= 0 && ret <= 4096) { return null; }
84                 org.ldk.structs.ParseOrSemanticError ret_hu_conv = org.ldk.structs.ParseOrSemanticError.constr_from_ptr(ret);
85                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
86                 return ret_hu_conv;
87         }
88
89         /**
90          * Checks if two ParseOrSemanticErrors contain equal inner contents.
91          * This ignores pointers and is_owned flags and looks at the values in fields.
92          */
93         public bool eq(org.ldk.structs.ParseOrSemanticError b) {
94                 bool ret = bindings.ParseOrSemanticError_eq(this.ptr, b == null ? 0 : b.ptr);
95                 GC.KeepAlive(this);
96                 GC.KeepAlive(b);
97                 return ret;
98         }
99
100         public override bool Equals(object o) {
101                 if (!(o is ParseOrSemanticError)) return false;
102                 return this.eq((ParseOrSemanticError)o);
103         }
104         /**
105          * Get the string representation of a ParseOrSemanticError object
106          */
107         public string to_str() {
108                 long ret = bindings.ParseOrSemanticError_to_str(this.ptr);
109                 GC.KeepAlive(this);
110                 if (ret >= 0 && ret <= 4096) { return null; }
111                 string ret_conv = InternalUtils.decodeString(ret);
112                 return ret_conv;
113         }
114
115 }
116 } } }