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


C++ OTData::IsEmpty方法代码示例

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


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

示例1: Assign

void OTData::Assign(const OTData &theSource)
{
	if ((&theSource) == this)
		return; // can't assign to self.
	
	if (false == theSource.IsEmpty()) // If something is there...
	{
		Assign(theSource.m_pData, theSource.m_lSize); // Copy it.
	}
	else
		Release(); // Otherwise if it's empty, then empty this also.
}
开发者ID:batouzo,项目名称:Open-Transactions,代码行数:12,代码来源:OTData.cpp

示例2: Assign

void OTData::Assign(const OTData& source)
{
    // can't assign to self.
    if (&source == this) {
        return;
    }

    if (!source.IsEmpty()) {
        Assign(source.data_, source.size_);
    }
    else {
        // Otherwise if it's empty, then empty this also.
        Release();
    }
}
开发者ID:Kodachi75,项目名称:opentxs,代码行数:15,代码来源:OTData.cpp

示例3: Windows_StoreSecret

// static
bool OTKeyring::Windows_StoreSecret(const OTString& strUser,
                                    const OTPassword& thePassword,
                                    const std::string& str_display)
{
    OT_ASSERT(strUser.Exists());
    OT_ASSERT(thePassword.getMemorySize() > 0);

    DATA_BLOB input;
    input.pbData = const_cast<BYTE*>(
        reinterpret_cast<const BYTE*>(thePassword.getMemory()));
    input.cbData = static_cast<DWORD>(thePassword.getMemorySize());

    //    CRYPTPROTECT_PROMPTSTRUCT PromptStruct;
    //    ZeroMemory(&PromptStruct, sizeof(PromptStruct));
    //    PromptStruct.cbSize = sizeof(PromptStruct);
    //    PromptStruct.dwPromptFlags = CRYPTPROTECT_PROMPT_ON_PROTECT;
    //    PromptStruct.szPrompt = L"This is a user prompt.";

    DATA_BLOB output;

    BOOL result = CryptProtectData(&input, L"", // description string
                                   nullptr,     // optional entropy
                                   nullptr,     // reserved
                                   nullptr,     //&PromptStruct
                                   0, &output);
    if (!result) {
        otErr << __FUNCTION__ << ": Failed calling Win32: CryptProtectData \n";
        return false;
    }

    //
    // this does a copy
    //
    //    std::string ciphertext;
    //    ciphertext.assign(reinterpret_cast<std::string::value_type*>(output.pbData),
    //                       output.cbData);

    OTData theOutput;
    theOutput.Assign(static_cast<void*>(output.pbData),
                     static_cast<uint32_t>(output.cbData));

    LocalFree(output.pbData); // Note: should have a check for nullptr here... ?
                              // And above...

    // Success encrypting to ciphertext (std::string or OTData)

    //
    // Write it to local storage.
    //
    if (theOutput.IsEmpty()) {
        otErr << __FUNCTION__
              << ": Error: Output of Win32 CryptProtectData was empty.\n";
    }
    else {
        OTASCIIArmor ascData(theOutput);
        const OTString strFoldername("win32_data"); // todo hardcoding.

        if (ascData.Exists())
            return ascData.WriteArmoredFile(strFoldername,
                                            strUser, // this is filename
                                            "WINDOWS KEYRING MASTERKEY");
    }

    return false;
}
开发者ID:Kodachi75,项目名称:opentxs,代码行数:66,代码来源:OTKeyring.cpp


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