本文整理汇总了C++中String::Concatenate方法的典型用法代码示例。如果您正苦于以下问题:C++ String::Concatenate方法的具体用法?C++ String::Concatenate怎么用?C++ String::Concatenate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类String
的用法示例。
在下文中一共展示了String::Concatenate方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WriteArmoredString
bool OTASCIIArmor::WriteArmoredString(
String& 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) const
{
const char* szEscape = "- ";
String strTemp;
strTemp.Format(
"%s%s %s-----\n" // "%s-----BEGIN OT ARMORED %s-----\n"
"Version: Open Transactions %s\n"
"Comment: "
"http://opentransactions.org\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"
Log::Version(), // "Version: Open Transactions %s\n"
/* No variable */ // "Comment:
// http://github.com/FellowTraveler/Open-Transactions/wiki\n\n",
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;
}
示例2: DisplayStatistics
bool AssetContract::DisplayStatistics(String& strContents) const
{
const String strID(m_ID);
strContents.Concatenate(" Asset Type: %s\n"
" InstrumentDefinitionID: %s\n"
"\n",
m_strName.Get(), strID.Get());
return true;
}
示例3: DisplayStatistics
void Nym::DisplayStatistics(String& strOutput) const
{
sLock lock(shared_lock_);
strOutput.Concatenate("Source for ID:\n%s\n", Source().asString()->Get());
strOutput.Concatenate("Description: %s\n\n", m_strDescription->Get());
strOutput.Concatenate("%s", "\n");
strOutput.Concatenate("==> Name: %s\n", Alias().c_str());
strOutput.Concatenate(" Version: %s\n", m_strVersion->Get());
auto theStringID = String::Factory(ID());
strOutput.Concatenate("Nym ID: %s\n", theStringID->Get());
}
示例4: GetPrivateCredentials
void Nym::GetPrivateCredentials(String& strCredList, String::Map* pmapCredFiles)
const
{
Tag tag("nymData");
tag.add_attribute("version", m_strVersion->Get());
auto strNymID = String::Factory(m_nymID);
tag.add_attribute("nymID", strNymID->Get());
SerializeNymIDSource(tag);
SaveCredentialsToTag(tag, nullptr, pmapCredFiles);
std::string str_result;
tag.output(str_result);
strCredList.Concatenate("%s", str_result.c_str());
}
示例5: SaveMainFileToString
bool MainFile::SaveMainFileToString(String& strMainFile)
{
Tag tag("notaryServer");
// We're on version 2.0 since adding the master key.
tag.add_attribute("version",
OTCachedKey::It()->IsGenerated() ? "2.0" : version_);
tag.add_attribute("notaryID", server_->m_strNotaryID.Get());
tag.add_attribute("serverNymID", server_->m_strServerNymID.Get());
tag.add_attribute("transactionNum",
formatLong(server_->transactor_.transactionNumber()));
if (OTCachedKey::It()->IsGenerated()) // If it exists, then serialize it.
{
OTASCIIArmor ascMasterContents;
if (OTCachedKey::It()->SerializeTo(ascMasterContents)) {
tag.add_tag("cachedKey", ascMasterContents.Get());
}
else
Log::vError(
"%s: Failed trying to write master key to notary file.\n",
__FUNCTION__);
}
for (auto& it : server_->transactor_.contractsMap_) {
Contract* pContract = it.second;
OT_ASSERT_MSG(nullptr != pContract,
"nullptr contract pointer in MainFile::SaveMainFile.\n");
// This is like the Server's wallet.
pContract->SaveContractWallet(tag);
}
// Save the basket account information
for (auto& it : server_->transactor_.idToBasketMap_) {
String strBasketID = it.first.c_str();
String strBasketAcctID = it.second.c_str();
const Identifier BASKET_ACCOUNT_ID(strBasketAcctID);
Identifier BASKET_CONTRACT_ID;
bool bContractID =
server_->transactor_.lookupBasketContractIDByAccountID(
BASKET_ACCOUNT_ID, BASKET_CONTRACT_ID);
if (!bContractID) {
Log::vError("%s: Error: Missing Contract ID for basket ID %s\n",
__FUNCTION__, strBasketID.Get());
break;
}
String strBasketContractID(BASKET_CONTRACT_ID);
TagPtr pTag(new Tag("basketInfo"));
pTag->add_attribute("basketID", strBasketID.Get());
pTag->add_attribute("basketAcctID", strBasketAcctID.Get());
pTag->add_attribute("basketContractID", strBasketContractID.Get());
tag.add_tag(pTag);
}
server_->transactor_.voucherAccounts_.Serialize(tag);
std::string str_result;
tag.output(str_result);
strMainFile.Concatenate("%s", str_result.c_str());
return true;
}