本文整理汇总了C++中OTTransactionType::SetLoadInsecure方法的典型用法代码示例。如果您正苦于以下问题:C++ OTTransactionType::SetLoadInsecure方法的具体用法?C++ OTTransactionType::SetLoadInsecure怎么用?C++ OTTransactionType::SetLoadInsecure使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OTTransactionType
的用法示例。
在下文中一共展示了OTTransactionType::SetLoadInsecure方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TransactionFactory
OTTransactionType* OTTransactionType::TransactionFactory(String strInput)
{
String strContract, strFirstLine; // output for the below function.
const bool bProcessed =
Contract::DearmorAndTrim(strInput, strContract, strFirstLine);
if (bProcessed) {
OTTransactionType* pContract = nullptr;
if (strFirstLine.Contains(
"-----BEGIN SIGNED TRANSACTION-----")) // this string is 34
// chars long.
{
pContract = new OTTransaction();
OT_ASSERT(nullptr != pContract);
}
else if (strFirstLine.Contains(
"-----BEGIN SIGNED TRANSACTION ITEM-----")) // this
// string is
// 39 chars
// long.
{
pContract = new Item();
OT_ASSERT(nullptr != pContract);
}
else if (strFirstLine.Contains(
"-----BEGIN SIGNED LEDGER-----")) // this string is 29
// chars long.
{
pContract = new Ledger();
OT_ASSERT(nullptr != pContract);
}
else if (strFirstLine.Contains(
"-----BEGIN SIGNED ACCOUNT-----")) // this string is 30
// chars long.
{
pContract = new Account();
OT_ASSERT(nullptr != pContract);
}
// The string didn't match any of the options in the factory.
//
const char* szFunc = "OTTransactionType::TransactionFactory";
// The string didn't match any of the options in the factory.
if (nullptr == pContract) {
otOut << szFunc
<< ": Object type not yet supported by class factory: "
<< strFirstLine << "\n";
return nullptr;
}
// This causes pItem to load ASSUMING that the PurportedAcctID and
// PurportedNotaryID are correct.
// The object is still expected to be internally consistent with its
// sub-items, regarding those IDs,
// but the big difference is that it will SET the Real Acct and Real
// Notary IDs based on the purported
// values. This way you can load a transaction without knowing the
// account in advance.
//
pContract->SetLoadInsecure();
// Does the contract successfully load from the string passed in?
if (pContract->LoadContractFromString(strContract)) {
// NOTE: this already happens in OTTransaction::ProcessXMLNode and
// OTLedger::ProcessXMLNode.
// Specifically, it happens when m_bLoadSecurely is set to false.
//
// pContract->SetRealNotaryID(pItem->GetPurportedNotaryID());
// pContract->SetRealAccountID(pItem->GetPurportedAccountID());
//
return pContract;
}
else {
otOut << szFunc
<< ": Failed loading contract from string (first line): "
<< strFirstLine << "\n";
delete pContract;
pContract = nullptr;
}
}
return nullptr;
}