mirror of
https://github.com/wownero/wownero-cpp.git
synced 2026-10-19 16:18:40 +02:00
cpp project compiling with boost::optional
This commit is contained in:
@@ -14,7 +14,7 @@ namespace monero {
|
||||
|
||||
// ---------------------------- PRIVATE HELPERS -----------------------------
|
||||
|
||||
bool boolEquals(bool val, boost::optional<bool> optVal) {
|
||||
bool boolEquals(bool val, const boost::optional<bool>& optVal) {
|
||||
return optVal == boost::none ? false : val == *optVal;
|
||||
}
|
||||
|
||||
@@ -494,9 +494,9 @@ namespace monero {
|
||||
|
||||
// translate from MoneroTxRequest to in, out, pending, pool, failed terminology
|
||||
bool canBeConfirmed = !boolEquals(false, txReq.isConfirmed) && !boolEquals(true, txReq.inTxPool) && !boolEquals(true, txReq.isFailed) && !boolEquals(false, txReq.isRelayed);
|
||||
bool canBeInTxPool = !boolEquals(true, txReq.isConfirmed) && !boolEquals(false, txReq.inTxPool) && !boolEquals(true, txReq.isFailed) && !boolEquals(false, txReq.isRelayed) && txReq.height == boost::none && txReq.minHeight == boost::none;
|
||||
bool canBeIncoming = !boolEquals(false, request.isIncoming) && !boolEquals(true, request.isOutgoing) && !boolEquals(true, request.hasDestinations);
|
||||
bool canBeOutgoing = !boolEquals(false, request.isOutgoing) && !boolEquals(true, request.isIncoming);
|
||||
bool canBeInTxPool = !boolEquals(true, txReq.isConfirmed) && !boolEquals(false, txReq.inTxPool) && !boolEquals(true, txReq.isFailed) && !boolEquals(false, txReq.isRelayed) && txReq.getHeight() == boost::none && txReq.minHeight == boost::none;
|
||||
bool canBeIncoming = !boolEquals(false, request.isIncoming) && !boolEquals(true, request.getIsOutgoing()) && !boolEquals(true, request.hasDestinations);
|
||||
bool canBeOutgoing = !boolEquals(false, request.getIsOutgoing()) && !boolEquals(true, request.isIncoming);
|
||||
bool isIn = canBeIncoming && canBeConfirmed;
|
||||
bool isOut = canBeOutgoing && canBeConfirmed;
|
||||
bool isPending = canBeOutgoing && canBeInTxPool;
|
||||
|
||||
@@ -146,6 +146,11 @@ namespace monero {
|
||||
vector<MoneroDestination> destinations;
|
||||
boost::optional<bool> hasDestinations;
|
||||
boost::optional<shared_ptr<MoneroTxRequest>> txRequest;
|
||||
|
||||
boost::optional<bool> getIsOutgoing() const {
|
||||
if (isIncoming == boost::none ) return boost::none;
|
||||
return !(*isIncoming);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -163,6 +168,8 @@ namespace monero {
|
||||
boost::optional<uint64_t> maxHeight;
|
||||
boost::optional<uint64_t> includeOutputs;
|
||||
boost::optional<MoneroTransferRequest> transferRequest;
|
||||
|
||||
boost::optional<uint64_t> getHeight() { return block == boost::none ? boost::none : (*block)->height; }
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user