本文整理汇总了C++中LLSD::assign方法的典型用法代码示例。如果您正苦于以下问题:C++ LLSD::assign方法的具体用法?C++ LLSD::assign怎么用?C++ LLSD::assign使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLSD
的用法示例。
在下文中一共展示了LLSD::assign方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: encryptPassword
const LLSD LLSavedLoginEntry::encryptPassword(const std::string& password)
{
LLSD pwdata;
if (password.size() == PASSWORD_HASH_LENGTH && LLStringOps::isHexString(password))
{
LLSD::Binary buffer(PASSWORD_HASH_LENGTH+1);
LLStringUtil::copy(reinterpret_cast<char*>(&buffer[0]), password.c_str(), PASSWORD_HASH_LENGTH+1);
buffer[PASSWORD_HASH_LENGTH] = '\0';
LLXORCipher cipher(gMACAddress, 6);
cipher.encrypt(&buffer[0], PASSWORD_HASH_LENGTH);
pwdata.assign(buffer);
}
return pwdata;
}
示例2: setControlValueCB
//----------------------------------------------------------------------------
// LLControlGroupCLP defintions
//----------------------------------------------------------------------------
void setControlValueCB(const LLCommandLineParser::token_vector_t& value,
const std::string& opt_name,
LLControlGroup* ctrlGroup)
{
// *FIX: Do sematic conversion here.
// LLSD (ImplString) Is no good for doing string to type conversion for...
// booleans
// compound types
// ?...
LLControlVariable* ctrl = ctrlGroup->getControl(opt_name);
if(NULL != ctrl)
{
switch(ctrl->type())
{
case TYPE_BOOLEAN:
if(value.size() > 1)
{
llwarns << "Ignoring extra tokens." << llendl;
}
if(value.size() > 0)
{
// There's a token. check the string for true/false/1/0 etc.
BOOL result = false;
BOOL gotSet = LLStringUtil::convertToBOOL(value[0], result);
if(gotSet)
{
ctrl->setValue(LLSD(result), false);
}
}
else
{
ctrl->setValue(LLSD(true), false);
}
break;
default:
{
// For the default types, let llsd do the conversion.
if(value.size() > 1 && ctrl->isType(TYPE_LLSD))
{
// Assume its an array...
LLSD llsdArray;
for(unsigned int i = 0; i < value.size(); ++i)
{
LLSD llsdValue;
llsdValue.assign(LLSD::String(value[i]));
llsdArray.set(i, llsdValue);
}
ctrl->setValue(llsdArray, false);
}
else if(value.size() > 0)
{
if(value.size() > 1)
{
llwarns << "Ignoring extra tokens mapped to the setting: " << opt_name << "." << llendl;
}
LLSD llsdValue;
llsdValue.assign(LLSD::String(value[0]));
ctrl->setValue(llsdValue, false);
}
}
break;
}
}
else
{
llwarns << "Command Line option mapping '"
<< opt_name
<< "' not found! Ignoring."
<< llendl;
}
}