6 namespace org { namespace ldk { namespace structs {
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.
13 public class ParseOrSemanticError : CommonBase {
14 protected ParseOrSemanticError(object _dummy, long ptr) : base(ptr) { }
15 ~ParseOrSemanticError() {
16 if (ptr != 0) { bindings.ParseOrSemanticError_free(ptr); }
19 internal static ParseOrSemanticError constr_from_ptr(long ptr) {
20 long raw_ty = bindings.LDKParseOrSemanticError_ty_from_ptr(ptr);
22 case 0: return new ParseOrSemanticError_ParseError(ptr);
23 case 1: return new ParseOrSemanticError_SemanticError(ptr);
25 throw new ArgumentException("Impossible enum variant");
29 /** A ParseOrSemanticError of type ParseError */
30 public class ParseOrSemanticError_ParseError : ParseOrSemanticError {
31 public ParseError 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.ParseError parse_error_hu_conv = org.ldk.structs.ParseError.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;
39 /** A ParseOrSemanticError of type SemanticError */
40 public class ParseOrSemanticError_SemanticError : ParseOrSemanticError {
41 public SemanticError semantic_error;
42 internal ParseOrSemanticError_SemanticError(long ptr) : base(null, ptr) {
43 this.semantic_error = bindings.LDKParseOrSemanticError_SemanticError_get_semantic_error(ptr);
46 internal long clone_ptr() {
47 long ret = bindings.ParseOrSemanticError_clone_ptr(this.ptr);
53 * Creates a copy of the ParseOrSemanticError
55 public ParseOrSemanticError clone() {
56 long ret = bindings.ParseOrSemanticError_clone(this.ptr);
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); };
65 * Utility method to constructs a new ParseError-variant ParseOrSemanticError
67 public static ParseOrSemanticError parse_error(org.ldk.structs.ParseError a) {
68 long ret = bindings.ParseOrSemanticError_parse_error(a.ptr);
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); };
77 * Utility method to constructs a new SemanticError-variant ParseOrSemanticError
79 public static ParseOrSemanticError semantic_error(SemanticError a) {
80 long ret = bindings.ParseOrSemanticError_semantic_error(a);
82 if (ret >= 0 && ret <= 4096) { return null; }
83 org.ldk.structs.ParseOrSemanticError ret_hu_conv = org.ldk.structs.ParseOrSemanticError.constr_from_ptr(ret);
84 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
89 * Checks if two ParseOrSemanticErrors contain equal inner contents.
90 * This ignores pointers and is_owned flags and looks at the values in fields.
92 public bool eq(org.ldk.structs.ParseOrSemanticError b) {
93 bool ret = bindings.ParseOrSemanticError_eq(this.ptr, b == null ? 0 : b.ptr);
99 public override bool Equals(object o) {
100 if (!(o is ParseOrSemanticError)) return false;
101 return this.eq((ParseOrSemanticError)o);
104 * Get the string representation of a ParseOrSemanticError object
106 public string to_str() {
107 string ret = bindings.ParseOrSemanticError_to_str(this.ptr);