本文整理汇总了C++中Tag::add_tag方法的典型用法代码示例。如果您正苦于以下问题:C++ Tag::add_tag方法的具体用法?C++ Tag::add_tag怎么用?C++ Tag::add_tag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tag
的用法示例。
在下文中一共展示了Tag::add_tag方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Serialize
void OTStash::Serialize(Tag& parent) const
{
uint32_t sizeMapStashItems = m_mapStashItems.size();
TagPtr pTag(new Tag("stash"));
pTag->add_attribute("name", m_str_stash_name);
pTag->add_attribute("count", formatUint(sizeMapStashItems));
for (auto& it : m_mapStashItems) {
const std::string str_instrument_definition_id = it.first;
OTStashItem* pStashItem = it.second;
OT_ASSERT((str_instrument_definition_id.size() > 0) &&
(nullptr != pStashItem));
TagPtr pTagItem(new Tag("stashItem"));
pTagItem->add_attribute("instrumentDefinitionID",
pStashItem->GetInstrumentDefinitionID().Get());
pTagItem->add_attribute("balance", formatLong(pStashItem->GetAmount()));
pTag->add_tag(pTagItem);
}
parent.add_tag(pTag);
}
示例2: Serialize
void OTClause::Serialize(Tag& parent) const
{
OTASCIIArmor ascCode;
if (m_strCode.GetLength() > 2)
ascCode.SetString(m_strCode);
else
otErr << "Empty script code in OTClause::Serialize()\n";
TagPtr pTag(new Tag("clause", ascCode.Get()));
pTag->add_attribute("name", m_strName.Get());
parent.add_tag(pTag);
}
示例3: Serialize
void OTClause::Serialize(Tag& parent) const
{
auto ascCode = Armored::Factory();
if (m_strCode->GetLength() > 2)
ascCode->SetString(m_strCode);
else
otErr << "Empty script code in OTClause::Serialize()\n";
TagPtr pTag(new Tag("clause", ascCode->Get()));
pTag->add_attribute("name", m_strName->Get());
parent.add_tag(pTag);
}
示例4: SerializeNymIDSource
void Nym::SerializeNymIDSource(Tag& parent) const
{
// We encode these before storing.
if (source_) {
TagPtr pTag(new Tag("nymIDSource", source_->asString()->Get()));
if (m_strDescription->Exists()) {
auto ascDescription = Armored::Factory();
ascDescription->SetString(
m_strDescription,
false); // bLineBreaks=true by default.
pTag->add_attribute("Description", ascDescription->Get());
}
parent.add_tag(pTag);
}
}
示例5: SaveCredentialsToTag
void Nym::SaveCredentialsToTag(
Tag& parent,
String::Map* pmapPubInfo,
String::Map* pmapPriInfo) const
{
// IDs for revoked child credentials are saved here.
for (auto& it : m_listRevokedIDs) {
std::string str_revoked_id = it;
TagPtr pTag(new Tag("revokedCredential"));
pTag->add_attribute("ID", str_revoked_id);
parent.add_tag(pTag);
}
// Serialize master and sub-credentials here.
for (auto& it : m_mapCredentialSets) {
CredentialSet* pCredential = it.second;
OT_ASSERT(nullptr != pCredential);
pCredential->SerializeIDs(
parent,
m_listRevokedIDs,
pmapPubInfo,
pmapPriInfo,
true); // bShowRevoked=false by default (true here), bValid=true
}
// Serialize Revoked master credentials here, including their child key
// credentials.
for (auto& it : m_mapRevokedSets) {
CredentialSet* pCredential = it.second;
OT_ASSERT(nullptr != pCredential);
pCredential->SerializeIDs(
parent,
m_listRevokedIDs,
pmapPubInfo,
pmapPriInfo,
true,
false); // bShowRevoked=false by default. (Here it's true.)
// bValid=true by default. Here is for revoked, so false.
}
}
示例6: SaveContractWallet
bool AssetContract::SaveContractWallet(Tag& parent) const
{
const String strID(m_ID);
// Name is in the clear in memory,
// and base64 in storage.
OTASCIIArmor ascName;
if (m_strName.Exists()) {
ascName.SetString(m_strName, false); // linebreaks == false
}
TagPtr pTag(new Tag("assetType"));
pTag->add_attribute("name", m_strName.Exists() ? ascName.Get() : "");
pTag->add_attribute("instrumentDefinitionID", strID.Get());
parent.add_tag(pTag);
return true;
}
示例7: SavePseudonymWallet
bool Nym::SavePseudonymWallet(Tag& parent) const
{
sLock lock(shared_lock_);
auto nymID = String::Factory(m_nymID);
// Name is in the clear in memory,
// and base64 in storage.
auto ascName = Armored::Factory();
if (!alias_.empty()) {
auto temp = String::Factory(alias_);
ascName->SetString(temp, false); // linebreaks == false
}
TagPtr pTag(new Tag("pseudonym"));
pTag->add_attribute("name", !alias_.empty() ? ascName->Get() : "");
pTag->add_attribute("nymID", nymID->Get());
parent.add_tag(pTag);
return true;
}