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


C++ OTString::Concatenate方法代码示例

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


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

示例1: UpdatePublicContentsToString

void OTSubcredential::UpdatePublicContentsToString(OTString & strAppendTo) // Used in UpdateContents.
{
    if (m_mapPublicInfo.size() > 0)
    {
        strAppendTo.Concatenate("<publicContents count=\"%d\">\n\n", m_mapPublicInfo.size());
        
        FOR_EACH(mapOfStrings, m_mapPublicInfo)
        {
            OTString     strInfo((*it).second);
            OTASCIIArmor ascInfo(strInfo);
            strAppendTo.Concatenate("<publicInfo key=\"%s\">\n%s</publicInfo>\n\n",
                                      (*it).first.c_str(), ascInfo.Get());
        }
开发者ID:Guratri,项目名称:Open-Transactions,代码行数:13,代码来源:OTSubcredential.cpp

示例2: SaveContractWallet

bool OTAccount::SaveContractWallet(OTString & strContents) const
{
	const OTString	strAccountID(GetPurportedAccountID()), 
					strServerID(GetPurportedServerID()), 
					strUserID(GetUserID()), 
					strAssetTypeID(m_AcctAssetTypeID);
	
	OTString strAcctType;
	TranslateAccountTypeToString(m_AcctType, strAcctType);
	
	OTASCIIArmor ascName;
	
	if (m_strName.Exists()) // name is in the clear in memory, and base64 in storage.
	{
		ascName.SetString(m_strName, false); // linebreaks == false
	}
	
	strContents.Concatenate("<!-- Last retrieved balance: %s on date: %s -->\n"
							"<!-- Account type: %s --><assetAccount name=\"%s\"\n"
							" accountID=\"%s\"\n" 
							" userID=\"%s\"\n"
							" serverID=\"%s\" />\n"
							"<!-- assetTypeID: %s -->\n\n",
							m_BalanceAmount.Get(), 
							m_BalanceDate.Get(), 
							strAcctType.Get(), 
							m_strName.Exists() ? ascName.Get() : "",
							strAccountID.Get(),
							strUserID.Get(),
							strServerID.Get(),
							strAssetTypeID.Get());
	return true;
}
开发者ID:germc,项目名称:Open-Transactions,代码行数:33,代码来源:OTAccount.cpp

示例3: DisplayStatistics

bool OTAccount::DisplayStatistics(OTString & strContents) const
{
	const OTString	strAccountID(GetPurportedAccountID()), strServerID(GetPurportedServerID()), 
					strUserID(GetUserID()), strAssetTypeID(m_AcctAssetTypeID);
	
	OTString strAcctType;
	TranslateAccountTypeToString(m_AcctType, strAcctType);
		
	strContents.Concatenate(
							" Asset Account (%s) Name: %s\n"
							" Last retrieved Balance: %s  on date: %s\n"
							" accountID: %s\n"
							" userID: %s\n"
							" serverID: %s\n"
							" assetTypeID: %s\n"
							"\n",
							strAcctType.Get(),
							m_strName.Get(),
							m_BalanceAmount.Get(), 
							m_BalanceDate.Get(), 
							strAccountID.Get(),
							strUserID.Get(),
							strServerID.Get(),
							strAssetTypeID.Get());
	
	return true;
}
开发者ID:germc,项目名称:Open-Transactions,代码行数:27,代码来源:OTAccount.cpp

示例4: WriteArmoredString

bool OTASCIIArmor::WriteArmoredString(OTString & strOutput,
                                      const // for "-----BEGIN OT LEDGER-----", str_type would contain "LEDGER"
                                        std::string str_type, // There's no default, to force you to enter the right string.
                                      bool bEscaped/*=false*/)
{   
    const char * szEscape = "- ";
    
    OTString strTemp;
    strTemp.Format("%s%s %s-----\n"    // "%s-----BEGIN OT ARMORED %s-----\n"
                   "Version: Open Transactions %s\n"
                   "Comment: http://github.com/FellowTraveler/Open-Transactions/wiki\n\n" // todo hardcoding.
                   "%s"                // Should already have a newline at the bottom.
                   "%s%s %s-----\n\n", // "%s-----END OT ARMORED %s-----\n"
                   bEscaped ? szEscape : "",
                   OT_BEGIN_ARMORED, 
                   str_type.c_str(),   // "%s%s %s-----\n"
                   OTLog::Version(),   // "Version: Open Transactions %s\n"
                   /* No variable */   // "Comment: http://github.com/FellowTraveler/Open-Transactions/wiki\n\n", 
                   this->Get(),        //  "%s"     <==== CONTENTS OF THIS OBJECT BEING WRITTEN...
                   bEscaped ? szEscape : "", 
                   OT_END_ARMORED, 
                   str_type.c_str());  // "%s%s %s-----\n"
    // -----------------------
    strOutput.Concatenate("%s", strTemp.Get());    
    // -----------------------
    return true;
}
开发者ID:9cat,项目名称:Open-Transactions,代码行数:27,代码来源:OTASCIIArmor.cpp

示例5: UpdateMasterPublicToString

void OTSubcredential::UpdateMasterPublicToString(OTString & strAppendTo) // Used in UpdateContents.
{
    OT_ASSERT(NULL != m_pOwner);
    OTASCIIArmor ascMaster(m_pOwner->GetPubCredential());
    strAppendTo.Concatenate("<masterPublic>\n%s</masterPublic>\n\n",
                            ascMaster.Get());
}
开发者ID:Guratri,项目名称:Open-Transactions,代码行数:7,代码来源:OTSubcredential.cpp

示例6: DisplayStatistics

bool OTAssetContract::DisplayStatistics(OTString & strContents) const
{
	const OTString strID(m_ID);
	
	strContents.Concatenate(
							" Asset Type:  %s\n"
							" AssetTypeID: %s\n"
							"\n",
							m_strName.Get(),
							strID.Get());
	return true;
}
开发者ID:rozgo,项目名称:Open-Transactions,代码行数:12,代码来源:OTAssetContract.cpp

示例7: Serialize

void OTAcctList::Serialize(OTString & strAppend)
{
	OTString strAcctType;
	TranslateAccountTypeToString(m_AcctType, strAcctType);

	strAppend.Concatenate("<accountList type=\"%s\" count=\"%d\" >\n\n",
						  strAcctType.Get(), m_mapAcctIDs.size());
	// -----------------

	FOR_EACH(mapOfStrings, m_mapAcctIDs)
	{
		const std::string str_asset_type_id	= (*it).first;
		const std::string str_account_id	= (*it).second;
		OT_ASSERT((str_asset_type_id.size()>0) && (str_account_id.size()>0));

		strAppend.Concatenate("<accountEntry assetTypeID=\"%s\" accountID=\"%s\" />\n\n",
							  str_asset_type_id.c_str(), str_account_id.c_str());
	}
	// -----------------
	strAppend.Concatenate("</accountList>\n\n");
}
开发者ID:Guratri,项目名称:Open-Transactions,代码行数:21,代码来源:OTAcctList.cpp

示例8: DisplayStatistics

bool OTServerContract::DisplayStatistics(OTString & strContents) const
{
	const OTString strID(m_ID);
	
	strContents.Concatenate(
							" Notary Provider: %s\n"
							" ServerID: %s\n"
							"\n",
							m_strName.Get(),
							strID.Get());
	
	return true;
}
开发者ID:germc,项目名称:Open-Transactions,代码行数:13,代码来源:OTServerContract.cpp

示例9: SaveContractWallet

bool OTServerContract::SaveContractWallet(OTString & strContents) const
{
	const OTString strID(m_ID);
	OTASCIIArmor   ascName;
	
	if (m_strName.Exists()) // name is in the clear in memory, and base64 in storage.
	{
		ascName.SetString(m_strName, false); // linebreaks == false
	}
	strContents.Concatenate("<notaryProvider name=\"%s\"\n"
							" serverID=\"%s\" />\n\n",
							m_strName.Exists() ? ascName.Get() : "",
							strID.Get());
	
	return true;
}
开发者ID:1manStartup,项目名称:Open-Transactions,代码行数:16,代码来源:OTServerContract.cpp

示例10: Serialize

void OTBylaw::Serialize(OTString & strAppend,
						bool bCalculatingID/*=false*/)
{
	strAppend.Concatenate("<bylaw\n name=\"%s\"\n"
						  " numVariables=\"%d\"\n"
						  " numClauses=\"%d\"\n"
						  " numHooks=\"%d\"\n"
						  " numCallbacks=\"%d\"\n"
						  " language=\"%s\" >\n\n",
						  m_strName.Get(),
						  m_mapVariables.size(), // HOW MANY VARIABLES?
						  m_mapClauses.size(), // HOW MANY CLAUSES?
						  m_mapHooks.size(), // How many HOOKS?
						  m_mapCallbacks.size(), // How many CALLBACK?
						  m_strLanguage.Get());
	// ------------------------------

	FOR_EACH(mapOfVariables, m_mapVariables)
	{
		OTVariable * pVar = (*it).second;
		OT_ASSERT(NULL != pVar);

		pVar->Serialize(strAppend, bCalculatingID); // Variables save in a specific state during ID calculation (no matter their current actual value.)
	}
开发者ID:ychaim,项目名称:Open-Transactions,代码行数:24,代码来源:OTBylaw.cpp

示例11: main


//.........这里部分代码省略.........

				OTString strCheque(theCheque);

				OTLog::vOutput(0, "\n\nOUTPUT:\n\n\n%s\n", strCheque.Get());
			}
			else 
			{
				OTLog::Output(0, "Failed trying to issue the cheque!\n");

				// IF FAILED, ADD TRANSACTION NUMBER BACK TO LIST OF AVAILABLE NUMBERS.
				g_pTemporaryNym->AddTransactionNum(*g_pTemporaryNym, strServerID, lTransactionNumber, true); // bSave=true								
			}

			continue;
		}

		else if (strLine.compare(0,7,"decrypt") == 0)
		{
			if (NULL == g_pTemporaryNym)
			{
				OTLog::Output(0, "No Nym yet available to decrypt with.\n");
				continue;
			}

			OTLog::Output(0, "Enter text to be decrypted:\n> ");

			OTASCIIArmor theArmoredText;
			char decode_buffer[200]; // Safe since we only read sizeof - 1

			do {
				decode_buffer[0] = 0;
				if (NULL != fgets(decode_buffer, sizeof(decode_buffer)-1, stdin))
				{
					theArmoredText.Concatenate("%s\n", decode_buffer);
					OTLog::Output(0, "> ");
				}
				else 
				{
					break;
				}
			} while (strlen(decode_buffer)>1);


			OTEnvelope	theEnvelope(theArmoredText);
			OTString	strDecodedText;

			theEnvelope.Open(*g_pTemporaryNym, strDecodedText);

			OTLog::vOutput(0, "\n\nDECRYPTED TEXT:\n\n%s\n\n", strDecodedText.Get());

			continue;
		}

		else if (strLine.compare(0,6,"decode") == 0)
		{
			OTLog::Output(0, "Enter text to be decoded:\n> ");

			OTASCIIArmor theArmoredText;
			char decode_buffer[200]; // Safe since we only read sizeof - 1.

			do {
				decode_buffer[0] = 0;
				if (NULL != fgets(decode_buffer, sizeof(decode_buffer)-1, stdin))
				{
					theArmoredText.Concatenate("%s\n", decode_buffer);
					OTLog::Output(0, "> ");
开发者ID:22367rh,项目名称:Open-Transactions,代码行数:67,代码来源:testclient.cpp

示例12: Serialize

void OTVariable::Serialize(OTString & strAppend,
						   bool bCalculatingID/*=false*/)
{
	// ---------------------------------------
	std::string str_access("");

	switch (m_Access) {
		case OTVariable::Var_Constant:		// This cannot be changed from inside the script.
			str_access = "constant";
			break;
		case OTVariable::Var_Persistent:	// This can be changed without notifying the parties.
			str_access = "persistent";
			break;
		case OTVariable::Var_Important:		// This cannot be changed without notifying the parties.
			str_access = "important";
			break;
		default:
			OTLog::Error("OTVariable::Serialize:  ERROR:  Bad variable type.\n");
			break;
	}
	// ---------------------------------------
	std::string str_type;

	switch (m_Type) {
		case OTVariable::Var_String:
		{
			str_type = "string";

			if ((false == bCalculatingID) && // we don't serialize the variable's value when calculating the
				(m_str_Value.size() > 0)) // owner OTScriptable's ID, since the value can change over time.
			{
				OTString strVal(m_str_Value.c_str());
				OTASCIIArmor ascVal(strVal);
				strAppend.Concatenate("<variable\n name=\"%s\"\n"
									  " value=\"%s\"\n"
									  " type=\"%s\"\n"
									  " access=\"%s\" >\n%s</variable>\n\n",
									  m_strName.Get(),
									  "exists",
									  str_type.c_str(),
									  str_access.c_str(),
									  ascVal.Get());
			}
			else
			{
				strAppend.Concatenate("<variable\n name=\"%s\"\n"
									  " value=\"%s\"\n"
									  " type=\"%s\"\n"
									  " access=\"%s\" />\n\n",
									  m_strName.Get(),
									  "none", // value
									  str_type.c_str(),
									  str_access.c_str());
			}
		}
			break;
		case OTVariable::Var_Integer:
			str_type = "integer";
			strAppend.Concatenate("<variable\n name=\"%s\"\n"
								  " value=\"%d\"\n"
								  " type=\"%s\"\n"
								  " access=\"%s\" />\n\n",
								  m_strName.Get(),
								  bCalculatingID ? 0 : m_nValue, // we don't serialize the variable's value when calculating the smart contract's ID.
								  str_type.c_str(), str_access.c_str());
			break;
		case OTVariable::Var_Bool:
			str_type = "bool";
			strAppend.Concatenate("<variable\n name=\"%s\"\n"
								  " value=\"%s\"\n"
								  " type=\"%s\"\n"
								  " access=\"%s\" />\n\n",
								  m_strName.Get(),
								  bCalculatingID ? "false" : (m_bValue ? "true" : "false"), // we don't serialize the variable's value when calculating the smart contract's ID.
								  str_type.c_str(), str_access.c_str());
			break;
		default:
			str_type = "ERROR_VARIABLE_TYPE";
			OTLog::Error("OTVariable::Serialize: Error, Wrong Type -- not serializing.\n");
			break;
	}
	// ---------------------------------------
}
开发者ID:BwRy,项目名称:Open-Transactions,代码行数:83,代码来源:OTVariable.cpp


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