当前位置: 首页>>代码示例>>C++>>正文


C++ OTIdentifier::GetString方法代码示例

本文整理汇总了C++中OTIdentifier::GetString方法的典型用法代码示例。如果您正苦于以下问题:C++ OTIdentifier::GetString方法的具体用法?C++ OTIdentifier::GetString怎么用?C++ OTIdentifier::GetString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OTIdentifier的用法示例。


在下文中一共展示了OTIdentifier::GetString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

// This constructor gets the string version of the ID passed in,
// and sets that string on this object. (For when you need a string
// version of an ID.)
OTString::OTString(const OTIdentifier & theValue) : m_lLength(0), m_lPosition(0), m_strBuffer(NULL)
{
//	Initialize();

    if (theValue.GetSize() > 0)
        theValue.GetString(*this);
}
开发者ID:kazcw,项目名称:Open-Transactions,代码行数:10,代码来源:OTString.cpp

示例2:

// This constructor gets the string version of the ID passed in,
// and sets that string on this object. (For when you need a string
// version of an ID.)
OTString::OTString(const OTIdentifier & theValue)
{
	Initialize();
	
	if (theValue.GetSize() > 0)
		theValue.GetString(*this);
}
开发者ID:germc,项目名称:Open-Transactions,代码行数:10,代码来源:OTString.cpp

示例3: strAssetTypeID


//.........这里部分代码省略.........
				// already somewhere, it's just a pointer sitting there, and we're not walking on each other's toes.
				//
				if (pShared)
				{
					OTLog::vOutput(0, "OTAcctList::GetOrCreateAccount: Warning: account (%s) was already in memory so I gave you a "
								   "pointer to the existing one. (But who else has a copy of it?) \n", str_account_id.c_str());
					return pShared;
				}

			}
			catch (...)
			{

			}


			// Though the weak pointer was there, the resource must have since been destroyed,
			// because I cannot lock a new shared ptr onto it.   :-(
			//
			// Therefore remove it from the map, and RE-LOAD IT.
			//
			m_mapWeakAccts.erase(it_weak);
		}

		// DIDN'T find the acct pointer, even though we had the ID.
		// (Or it was there, but we couldn't lock a shared_ptr onto it, so we erased it...)
		//
		// So let's load it now. After all, the Account ID *does* exist...
		//
		const OTString strAcctID(str_account_id.c_str());
		const OTIdentifier theAccountID(strAcctID);

		// The Account ID exists, but we don't have the pointer to a loaded account for it.
		// Soo.... let's load it.
		//
		OTAccount * pAccount = OTAccount::LoadExistingAccount(theAccountID, SERVER_ID);

		if (NULL == pAccount)
			OTLog::vError("OTAcctList::GetOrCreateAccount: Failed trying to load %s account with account ID: %s\n",
						  strAcctType.Get(),strAcctID.Get());
		else if (!pAccount->VerifySignature(theServerNym))
			OTLog::vError("OTAcctList::GetOrCreateAccount: Failed verifying server's signature on %s account with account ID: %s\n",
						  strAcctType.Get(),strAcctID.Get());
		else if (!pAccount->VerifyOwnerByID(ACCOUNT_OWNER_ID))
		{
			const OTString strOwnerID(ACCOUNT_OWNER_ID);
			OTLog::vError("OTAcctList::GetOrCreateAccount: Failed verifying owner ID (%s) on %s account ID: %s\n",
						  strOwnerID.Get(), strAcctType.Get(),strAcctID.Get());
		}
		else // SUCCESS loading the account...
		{
			OTLog::vOutput(3, "Successfully loaded %s account ID: %s Asset Type ID: %s\n",
						   strAcctType.Get(), strAcctID.Get(), str_asset_type_id.c_str());

			pRetVal								= _SharedPtr<OTAccount>(pAccount); // Create a shared pointer to the account, so it will be cleaned up automatically.
			m_mapWeakAccts [strAcctID.Get()]	= _WeakPtr<OTAccount>(pRetVal); // save a weak pointer to the acct, so we'll never load it twice, but we'll also know if it's been deleted.
		}
		return pRetVal;
		//
	} // (Asset Type ID was found on the AcctID Map -- a corresponding Account ID is already there for that asset type.)

	// ******************************************************************************

	// Not found... There's no account ID yet for that asset type ID.
	// That means we can create it...
	//
	OTMessage theMessage; // Here we set up theMessage
	ACCOUNT_OWNER_ID.GetString(theMessage.m_strNymID);
	ASSET_TYPE_ID.GetString(theMessage.m_strAssetID);
	SERVER_ID.GetString(theMessage.m_strServerID);

	OTAccount * pAccount = OTAccount::GenerateNewAccount(ACCOUNT_OWNER_ID,	// theUserID
														 SERVER_ID,			// theServerID
														 theServerNym,		// theServerNym
														 theMessage,
														 m_AcctType,		// OTAccount::voucher is default.
														 lStashTransNum);
	// ------------------------------------------------------------------------------------------

	if (NULL == pAccount)
		OTLog::vError(" OTAcctList::GetOrCreateAccount: Failed trying to generate %s account with asset type ID: %s\n",
					  strAcctType.Get(), str_asset_type_id.c_str());
	else // SUCCESS creating the account...
	{
		OTString strAcctID;
		pAccount->GetIdentifier(strAcctID);

		OTLog::vOutput(0, "Successfully created %s account ID: %s Asset Type ID: %s\n",
					   strAcctType.Get(), strAcctID.Get(), str_asset_type_id.c_str());

		pRetVal = _SharedPtr<OTAccount>(pAccount); // Create a shared pointer to the account, so it will be cleaned up automatically.

		m_mapWeakAccts	[strAcctID.Get()]				= _WeakPtr<OTAccount>(pRetVal); // save a weak pointer to the acct, so we'll never load it twice, but we'll also know if it's been deleted.
		m_mapAcctIDs	[theMessage.m_strAssetID.Get()]	= strAcctID.Get(); // Save the new acct ID in a map, keyed by asset type ID.

		bWasAcctCreated = true;
	}

	return pRetVal;
}
开发者ID:Guratri,项目名称:Open-Transactions,代码行数:101,代码来源:OTAcctList.cpp


注:本文中的OTIdentifier::GetString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。