elements/src/util
furszy 7a45c33d1f
Introduce generic 'Result' class
Useful to encapsulate the function result object (in case of having it) or, in case of failure, the failure reason.

This let us clean lot of boilerplate code, as now instead of returning a boolean and having to add a ref arg for the
return object and another ref for the error string. We can simply return a 'BResult<Obj>'.

Example of what we currently have:
```
bool doSomething(arg1, arg2, arg3, arg4, &result, &error_string) {
    do something...
    if (error) {
        error_string = "something bad happened";
        return false;
    }

    result = goodResult;
    return true;
}
```

Example of what we will get with this commit:
```
BResult<Obj> doSomething(arg1, arg2, arg3, arg4) {
    do something...
    if (error) return {"something happened"};

    // good
    return {goodResult};
}
```

This allows a similar boilerplate cleanup on the function callers side as well. They don't have to add the extra
pre-function-call error string and result object declarations to pass the references to the function.
2022-07-08 11:18:35 -03:00
..
asmap.cpp refactor: replace boost::filesystem with std::filesystem 2022-02-03 18:35:52 +08:00
asmap.h
bip32.cpp
bip32.h refactor: Remove defunct attributes.h includes 2022-05-21 13:54:33 -05:00
bytevectorhash.cpp refactor: make GetRand a template, remove GetRandInt 2022-04-22 09:04:39 -05:00
bytevectorhash.h
check.cpp util/check: stop using lambda for Assert/Assume 2022-03-30 23:09:13 +10:00
check.h lint: Mention NONFATAL_UNREACHABLE in lint-assertions.py 2022-04-26 10:01:54 +02:00
designator.h Use designated initializers 2022-06-01 20:06:01 +02:00
epochguard.h util, refactor: Add UNIQUE_NAME helper macro 2022-02-16 14:59:20 +02:00
error.cpp [rpc] add new submitpackage RPC 2022-06-23 14:35:04 +01:00
error.h [rpc] add new submitpackage RPC 2022-06-23 14:35:04 +01:00
fastrange.h Add FastRange32 function and use it throughout the codebase 2022-01-07 13:37:47 -05:00
fees.cpp
fees.h
getuniquepath.cpp Disallow more unsafe string->path conversions allowed by path append operators 2022-04-21 12:01:00 -05:00
getuniquepath.h
golombrice.h [moveonly] Move MapIntoRange() to separate util/fastrange.h 2022-01-06 11:27:06 -05:00
hash_type.h
hasher.cpp refactor: make GetRand a template, remove GetRandInt 2022-04-22 09:04:39 -05:00
hasher.h
macros.h util, refactor: Add UNIQUE_NAME helper macro 2022-02-16 14:59:20 +02:00
message.cpp Make DecodeBase{32,64} return optional instead of taking bool* 2022-04-27 14:12:55 +02:00
message.h
moneystr.cpp scripted-diff: Rename ValidAsCString to ContainsNoNUL 2022-04-27 14:16:35 +02:00
moneystr.h refactor: Remove defunct attributes.h includes 2022-05-21 13:54:33 -05:00
overflow.h util: Add SaturatingAdd helper 2022-02-21 14:32:53 +01:00
overloaded.h
rbf.cpp
rbf.h
readwritefile.cpp util: Fix ReadBinaryFile reading beyond maxsize 2022-02-19 18:39:43 +08:00
readwritefile.h
result.h Introduce generic 'Result' class 2022-07-08 11:18:35 -03:00
serfloat.cpp
serfloat.h
settings.cpp settings: Add update/getPersistent/isIgnored methods 2022-05-19 11:32:56 -04:00
settings.h settings: Add update/getPersistent/isIgnored methods 2022-05-19 11:32:56 -04:00
sock.cpp Merge bitcoin/bitcoin#24378: refactor: make bind() and listen() mockable/testable 2022-06-28 15:10:00 +02:00
sock.h Merge bitcoin/bitcoin#24378: refactor: make bind() and listen() mockable/testable 2022-06-28 15:10:00 +02:00
spanparsing.cpp refactor: introduce single-separator split helper SplitString 2022-04-11 22:19:46 +02:00
spanparsing.h Extend Split to work with multiple separators 2022-05-04 07:34:47 +02:00
strencodings.cpp Merge bitcoin/bitcoin#23595: util: Add ParseHex<std::byte>() helper 2022-05-20 10:47:30 +02:00
strencodings.h refactor: Remove defunct attributes.h includes 2022-05-21 13:54:33 -05:00
string.cpp Wrap boost::replace_all 2022-05-05 20:50:24 +02:00
string.h Wrap boost::replace_all 2022-05-05 20:50:24 +02:00
syscall_sandbox.cpp Remove gui-only syscalls 2022-04-05 13:30:06 +02:00
syscall_sandbox.h init: Disable syscall sandbox in the bitcoin-qt process 2022-04-05 13:29:42 +02:00
syserror.cpp util: Increase buffer size to 1024 in SysErrorString 2022-04-28 10:24:06 +02:00
syserror.h util: Replace non-threadsafe strerror 2022-04-28 10:24:06 +02:00
system.cpp util: remove MSVC warning pragmas 2022-06-29 11:09:18 +01:00
system.h ArgsMan: Add Get*Arg functions returning optional 2022-06-22 18:18:52 -04:00
thread.cpp
thread.h
threadnames.cpp refactor: add missing std:: includes to threadnames.cpp 2022-04-01 14:49:13 +01:00
threadnames.h
time.cpp Add mockable clock type and TicksSinceEpoch helper 2022-05-18 18:58:05 +02:00
time.h Replace CountSecondsDouble with Ticks<SecondsDouble> 2022-06-27 09:34:09 +02:00
tokenpipe.cpp Guard #include <config/bitcoin-config.h> 2022-05-02 16:41:30 +02:00
tokenpipe.h
trace.h
translation.h
types.h
ui_change_type.h
url.cpp
url.h
vector.h