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


C++ Tag::add_tag方法代码示例

本文整理汇总了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);
}
开发者ID:Kodachi75,项目名称:opentxs,代码行数:26,代码来源:OTStash.cpp

示例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);
}
开发者ID:bitcredit-currency,项目名称:opentxs,代码行数:15,代码来源:OTClause.cpp

示例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);
}
开发者ID:Open-Transactions,项目名称:opentxs,代码行数:15,代码来源:OTClause.cpp

示例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);
    }
}
开发者ID:Open-Transactions,项目名称:opentxs,代码行数:18,代码来源:Nym.cpp

示例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.
    }
}
开发者ID:Open-Transactions,项目名称:opentxs,代码行数:42,代码来源:Nym.cpp

示例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;
}
开发者ID:bitcredit-currency,项目名称:opentxs,代码行数:20,代码来源:AssetContract.cpp

示例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;
}
开发者ID:Open-Transactions,项目名称:opentxs,代码行数:23,代码来源:Nym.cpp


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