本文整理汇总了C++中CVariant::GetSize方法的典型用法代码示例。如果您正苦于以下问题:C++ CVariant::GetSize方法的具体用法?C++ CVariant::GetSize怎么用?C++ CVariant::GetSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CVariant
的用法示例。
在下文中一共展示了CVariant::GetSize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadData
bool CKadScript::LoadData(const wstring& Path)
{
CVariant Data;
if(!ReadFile(Path, Data))
return false;
try
{
m_LastUsed = Data["LastUsed"].To<uint64>();
if(!m_LastUsed)
m_LastUsed = GetTime();
m_Data->Set(Data["Data"]);
if(Data.Has("KEY"))
{
CVariant SecretKey = Data["KEY"];
if(SecretKey.Decrypt(GetParent<CKademlia>()->Root()->GetID().GetPrivateKey()))
{
m_SecretKey = new CAbstractKey;
if(!m_SecretKey->SetKey(SecretKey.GetData(), SecretKey.GetSize()))
m_SecretKey = NULL;
}
}
m_Authentication = Data.Get("AUTH");
}
catch(const CException&)
{
return false;
}
return true;
}
示例2: Init
void CUIntX::Init(const CVariant& Variant)
{
if(Variant.GetSize() != GetSize())
throw CException(LOG_ERROR | LOG_DEBUG, L"Variant is not a uInt128");
memcpy(GetData(), Variant.GetData(), GetSize());
}
示例3: StartLookup
CVariant CKademlia::StartLookup(const CUInt128& TargetID, const CVariant& CodeID, const TCallMap& Execute, const TStoreMap& Store, CPrivateKey* pStoreKey, const TLoadMap& Load
, int Timeout, int HopLimit, int JumpCount, int SpreadCount, bool bTrace, const wstring& Name)
{
if(!m_pKadHandler)
return CVariant();
if(!CodeID.IsValid() && Store.empty() && Load.empty())
{
LogLine(LOG_ERROR, L"Attempted to start an empty Lookup");
return CVariant();
}
CPointer<CKadTask> pLookup = new CKadTask(TargetID, m_pLookupManager);
pLookup->SetName(Name);
if(Timeout != -1)
pLookup->SetTimeOut(Timeout);
if(HopLimit != -1)
pLookup->SetHopLimit(HopLimit);
if(JumpCount != -1)
pLookup->SetJumpCount(JumpCount);
if(SpreadCount != -1)
pLookup->SetSpreadCount(SpreadCount);
if(bTrace)
pLookup->EnableTrace();
if(pStoreKey)
pLookup->SetStoreKey(pStoreKey);
for(TStoreMap::const_iterator I = Store.begin(); I != Store.end(); I++)
pLookup->Store(I->first, I->second.Path, I->second.Data);
for(TLoadMap::const_iterator I = Load.begin(); I != Load.end(); I++)
pLookup->Load(I->first, I->second.Path);
if(CodeID.IsValid())
{
if(!pLookup->SetupScript(CodeID))
{
LogLine(LOG_ERROR, L"Attempted to start a smart lookup with an unavailable script: %s", ToHex(CodeID.GetData(), CodeID.GetSize()).c_str());
return CVariant();
}
for(TCallMap::const_iterator I = Execute.begin(); I != Execute.end(); I++)
pLookup->AddCall(I->second.Function, I->second.Parameters, I->first);
}
CVariant LookupID = m_pLookupManager->StartLookup(pLookup.Obj());
return LookupID;
}