本文整理汇总了C++中sle::pointer::getType方法的典型用法代码示例。如果您正苦于以下问题:C++ pointer::getType方法的具体用法?C++ pointer::getType怎么用?C++ pointer::getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sle::pointer
的用法示例。
在下文中一共展示了pointer::getType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: makeEntry
LedgerEntry::pointer LedgerEntry::makeEntry(SLE::pointer sle)
{
switch (sle->getType())
{
case ltACCOUNT_ROOT:
return LedgerEntry::pointer(new AccountEntry(sle));
case ltRIPPLE_STATE:
return LedgerEntry::pointer(new TrustLine(sle));
case ltOFFER:
return LedgerEntry::pointer(new OfferEntry(sle));
case ltOWNERSHIP:
return LedgerEntry::pointer(new Ownership(sle));
case ltOBJECT_DESC:
return LedgerEntry::pointer(new ObjectInfo(sle));
}
return(LedgerEntry::pointer());
}
示例2: doAccountOffers
// {
// account: <account>|<account_public_key>
// account_index: <number> // optional, defaults to 0.
// ledger_hash : <ledger>
// ledger_index : <ledger_index>
// limit: integer // optional
// marker: opaque // optional, resume previous query
// }
Json::Value doAccountOffers (RPC::Context& context)
{
auto const& params (context.params_);
Ledger::pointer ledger;
Json::Value result (RPC::lookupLedger (params, ledger, context.netOps_));
if (! ledger)
return result;
if (! params.isMember (jss::account))
return RPC::missing_field_error ("account");
std::string strIdent (params[jss::account].asString ());
bool bIndex (params.isMember (jss::account_index));
int const iIndex (bIndex ? params[jss::account_index].asUInt () : 0);
RippleAddress rippleAddress;
result = RPC::accountFromString (ledger, rippleAddress, bIndex, strIdent,
iIndex, false, context.netOps_);
if (! result.empty ())
return result;
// Get info on account.
result[jss::account] = rippleAddress.humanAccountID ();
if (bIndex)
result[jss::account_index] = iIndex;
if (! ledger->hasAccount (rippleAddress))
return rpcError (rpcACT_NOT_FOUND);
unsigned int limit;
if (params.isMember (jss::limit))
{
limit = std::max (RPC::Tuning::minOffersPerRequest,
std::min (params[jss::limit].asUInt (),
RPC::Tuning::maxOffersPerRequest));
}
else
{
limit = RPC::Tuning::defaultOffersPerRequest;
}
Account const& raAccount (rippleAddress.getAccountID ());
Json::Value& jsonOffers (result[jss::offers] = Json::arrayValue);
std::vector <SLE::pointer> offers;
unsigned int reserve (limit);
uint256 startAfter;
std::uint64_t startHint;
if (params.isMember(jss::marker))
{
// We have a start point. Use limit - 1 from the result and use the
// very last one for the resume.
Json::Value const& marker (params[jss::marker]);
if (! marker.isString ())
return rpcError (rpcACT_MALFORMED);
startAfter.SetHex (marker.asString ());
SLE::pointer sleOffer (ledger->getSLEi (startAfter));
if (sleOffer == nullptr ||
sleOffer->getType () != ltOFFER ||
raAccount != sleOffer->getFieldAccount160 (sfAccount))
{
return rpcError (rpcINVALID_PARAMS);
}
startHint = sleOffer->getFieldU64(sfOwnerNode);
// Caller provided the first offer (startAfter), add it as first result
Json::Value& obj (jsonOffers.append (Json::objectValue));
sleOffer->getFieldAmount (sfTakerPays).setJson (obj[jss::taker_pays]);
sleOffer->getFieldAmount (sfTakerGets).setJson (obj[jss::taker_gets]);
obj[jss::seq] = sleOffer->getFieldU32 (sfSequence);
obj[jss::flags] = sleOffer->getFieldU32 (sfFlags);
offers.reserve (reserve);
}
else
{
startHint = 0;
// We have no start point, limit should be one higher than requested.
offers.reserve (++reserve);
}
if (! ledger->visitAccountItems (raAccount, startAfter, startHint, reserve,
[&offers](SLE::ref offer)
//.........这里部分代码省略.........