compiling; ready to impl MoneroTransfer copy()

This commit is contained in:
woodser
2019-07-28 16:12:05 -04:00
parent 7d33ba450b
commit 14dbe5d9de
4 changed files with 48 additions and 9 deletions
+7 -3
View File
@@ -183,9 +183,9 @@ namespace monero {
throw runtime_error("MoneroTx deep copy constructor not implemented");
}
// shared_ptr<MoneroTx> MoneroTx::copy() const {
// return MoneroTx(this);
// }
shared_ptr<MoneroTx> MoneroTx::copy() const {
return make_shared<MoneroTx>();
}
boost::property_tree::ptree MoneroTx::toPropertyTree() const {
boost::property_tree::ptree node;
@@ -386,6 +386,10 @@ namespace monero {
throw runtime_error("MoneroOutput deep copy not implemented");
}
shared_ptr<MoneroOutput> MoneroOutput::copy() const {
return make_shared<MoneroOutput>();
}
boost::property_tree::ptree MoneroOutput::toPropertyTree() const {
boost::property_tree::ptree node;
if (keyImage != boost::none) node.add_child("keyImage", (*keyImage)->toPropertyTree());
+2 -1
View File
@@ -194,7 +194,7 @@ namespace monero {
MoneroTx(); // default constructor
MoneroTx(const MoneroTx& tx); // deep copy constructor
//shared_ptr<MoneroTx> MoneroTx::copy() const;
shared_ptr<MoneroTx> copy() const;
boost::property_tree::ptree toPropertyTree() const;
virtual void merge(const shared_ptr<MoneroTx>& self, const shared_ptr<MoneroTx>& other);
boost::optional<uint64_t> getHeight() const;
@@ -224,6 +224,7 @@ namespace monero {
MoneroOutput();
MoneroOutput(const MoneroOutput& output); // deep copy constructor
shared_ptr<MoneroOutput> copy() const;
boost::property_tree::ptree toPropertyTree() const;
virtual void merge(const shared_ptr<MoneroOutput>& self, const shared_ptr<MoneroOutput>& other);
};
+31 -3
View File
@@ -169,6 +169,10 @@ namespace monero {
throw runtime_error("MoneroTxRequest deep copy constructor not implemented");
}
shared_ptr<MoneroTxRequest> MoneroTxRequest::copy() const {
return make_shared<MoneroTxRequest>();
}
boost::property_tree::ptree MoneroTxRequest::toPropertyTree() const {
boost::property_tree::ptree node = MoneroTxWallet::toPropertyTree();
if (isOutgoing != boost::none) node.put("isOutgoing", *isOutgoing);
@@ -254,6 +258,10 @@ namespace monero {
throw runtime_error("MoneroTransfer deep copy constructor not implemented");
}
shared_ptr<MoneroTransfer> MoneroTransfer::copy() const {
//return make_shared<MoneroTransfer>(); // TODO: MoneroTransfer is abstract
}
boost::property_tree::ptree MoneroTransfer::toPropertyTree() const {
boost::property_tree::ptree node;
if (amount != boost::none) node.put("amount", *amount);
@@ -296,6 +304,10 @@ namespace monero {
throw runtime_error("MoneroIncomingTransfer deepy copy not implemented");
}
shared_ptr<MoneroIncomingTransfer> MoneroIncomingTransfer::copy() const {
return make_shared<MoneroIncomingTransfer>();
}
boost::optional<bool> MoneroIncomingTransfer::getIsIncoming() const { return true; }
boost::property_tree::ptree MoneroIncomingTransfer::toPropertyTree() const {
@@ -326,6 +338,10 @@ namespace monero {
throw runtime_error("MoneroOutgoingTransfer deep copy not implemented");
}
shared_ptr<MoneroOutgoingTransfer> MoneroOutgoingTransfer::copy() const {
return make_shared<MoneroOutgoingTransfer>();
}
boost::optional<bool> MoneroOutgoingTransfer::getIsIncoming() const { return false; }
boost::property_tree::ptree MoneroOutgoingTransfer::toPropertyTree() const {
@@ -358,9 +374,9 @@ namespace monero {
throw runtime_error("MoneroTransferRequet deep copy not implemented");
}
// shared_ptr<MoneroTransfer>MoneroTransferRequest::copy() const {
//
// }
shared_ptr<MoneroTransferRequest> MoneroTransferRequest::copy() const {
return make_shared<MoneroTransferRequest>();
}
boost::optional<bool> MoneroTransferRequest::getIsIncoming() const { return isIncoming; }
@@ -458,6 +474,10 @@ namespace monero {
throw runtime_error("MoneroOutputWallet deep copy constructor not implemented");
}
shared_ptr<MoneroOutputWallet> MoneroOutputWallet::copy() const {
return make_shared<MoneroOutputWallet>();
}
boost::property_tree::ptree MoneroOutputWallet::toPropertyTree() const {
boost::property_tree::ptree node = MoneroOutput::toPropertyTree();
if (accountIndex != boost::none) node.put("accountIndex", *accountIndex);
@@ -482,6 +502,14 @@ namespace monero {
}
MoneroOutputRequest::MoneroOutputRequest(const MoneroOutputRequest& request) {
throw runtime_error("MonerOutputRequest deep copy not implemented");
}
shared_ptr<MoneroOutputRequest> MoneroOutputRequest::copy() const {
return make_shared<MoneroOutputRequest>();
}
boost::property_tree::ptree MoneroOutputRequest::toPropertyTree() const {
boost::property_tree::ptree node = MoneroOutputWallet::toPropertyTree();
if (!subaddressIndices.empty()) node.add_child("subaddressIndices", MoneroUtils::toPropertyTree(subaddressIndices));
+8 -2
View File
@@ -149,6 +149,7 @@ namespace monero {
MoneroTransfer();
MoneroTransfer(const MoneroTransfer& transfer); // deep copy constructor
shared_ptr<MoneroTransfer> copy() const;
virtual boost::optional<bool> getIsIncoming() const = 0; // derived class must implement
boost::optional<bool> getIsOutgoing() const {
if (getIsIncoming() == boost::none) return boost::none;
@@ -167,6 +168,7 @@ namespace monero {
MoneroIncomingTransfer();
MoneroIncomingTransfer(const MoneroIncomingTransfer& transfer); // deep copy constructor
shared_ptr<MoneroIncomingTransfer> copy() const;
boost::optional<bool> getIsIncoming() const;
boost::property_tree::ptree toPropertyTree() const;
void merge(const shared_ptr<MoneroTransfer>& self, const shared_ptr<MoneroTransfer>& other);
@@ -183,6 +185,7 @@ namespace monero {
MoneroOutgoingTransfer();
MoneroOutgoingTransfer(const MoneroOutgoingTransfer& transfer);
shared_ptr<MoneroOutgoingTransfer> copy() const;
boost::optional<bool> getIsIncoming() const;
boost::property_tree::ptree toPropertyTree() const;
void merge(const shared_ptr<MoneroTransfer>& self, const shared_ptr<MoneroTransfer>& other);
@@ -206,7 +209,7 @@ namespace monero {
MoneroTransferRequest();
MoneroTransferRequest(const MoneroTransferRequest& request);
//shared_ptr<MoneroTransferRequest> copy() const;
shared_ptr<MoneroTransferRequest> copy() const;
boost::optional<bool> getIsIncoming() const;
boost::property_tree::ptree toPropertyTree() const;
bool meetsCriteria(MoneroTransfer* transfer) const;
@@ -224,6 +227,7 @@ namespace monero {
MoneroOutputWallet();
MoneroOutputWallet(const MoneroOutputWallet& output); // deep copy constructor
shared_ptr<MoneroOutputWallet> copy() const;
boost::property_tree::ptree toPropertyTree() const;
void merge(const shared_ptr<MoneroOutput>& self, const shared_ptr<MoneroOutput>& other);
void merge(const shared_ptr<MoneroOutputWallet>& self, const shared_ptr<MoneroOutputWallet>& other);
@@ -239,9 +243,9 @@ namespace monero {
vector<uint32_t> subaddressIndices;
boost::optional<shared_ptr<MoneroTxRequest>> txRequest;
MoneroOutputRequest();
MoneroOutputRequest(const MoneroOutputRequest& request); // deep copy constructor
shared_ptr<MoneroOutputRequest> copy() const;
boost::property_tree::ptree toPropertyTree() const;
bool meetsCriteria(MoneroOutputWallet* output) const;
};
@@ -256,6 +260,7 @@ namespace monero {
MoneroTxWallet();
MoneroTxWallet(const MoneroTxWallet& tx);
shared_ptr<MoneroTxWallet> copy() const;
bool getIsIncoming() const;
bool getIsOutgoing() const;
boost::property_tree::ptree toPropertyTree() const;
@@ -283,6 +288,7 @@ namespace monero {
MoneroTxRequest();
MoneroTxRequest(const MoneroTxRequest& txRequest);
shared_ptr<MoneroTxRequest> copy() const;
boost::property_tree::ptree toPropertyTree() const;
bool meetsCriteria(MoneroTxWallet* tx) const;
};