本文整理汇总了C++中LLControlVariable::isType方法的典型用法代码示例。如果您正苦于以下问题:C++ LLControlVariable::isType方法的具体用法?C++ LLControlVariable::isType怎么用?C++ LLControlVariable::isType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLControlVariable
的用法示例。
在下文中一共展示了LLControlVariable::isType方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: findString
std::string LLControlGroup::findString(const std::string& name)
{
LLControlVariable* control = getControl(name);
if (control && control->isType(TYPE_STRING))
return control->get().asString();
return LLStringUtil::null;
}
示例2: getLLSD
LLSD LLControlGroup::getLLSD(const std::string& name)
{
LLControlVariable* control = getControl(name);
if (control && control->isType(TYPE_LLSD))
return control->getValue();
CONTROL_ERRS << "Invalid LLSD control " << name << llendl;
return LLSD();
}
示例3: getControl
LLColor3 LLControlGroup::getColor3(const std::string& name)
{
LLControlVariable* control = getControl(name);
if (control && control->isType(TYPE_COL3))
return control->get();
else
{
CONTROL_ERRS << "Invalid LLColor3 control " << name << llendl;
return LLColor3::white;
}
}
示例4: getString
std::string LLControlGroup::getString(const std::string& name)
{
LLControlVariable* control = getControl(name);
if (control && control->isType(TYPE_STRING))
return control->get().asString();
else
{
CONTROL_ERRS << "Invalid string control " << name << llendl;
return LLStringUtil::null;
}
}
示例5: getBOOL
BOOL LLControlGroup::getBOOL(const std::string& name)
{
LLControlVariable* control = getControl(name);
if (control && control->isType(TYPE_BOOLEAN))
return control->get().asBoolean();
else
{
CONTROL_ERRS << "Invalid BOOL control " << name << llendl;
return FALSE;
}
}
示例6: getRect
LLRect LLControlGroup::getRect(const std::string& name)
{
LLControlVariable* control = getControl(name);
if (control && control->isType(TYPE_RECT))
return control->get();
else
{
CONTROL_ERRS << "Invalid rect control " << name << llendl;
return LLRect::null;
}
}
示例7: setLLSD
void LLControlGroup::setLLSD(const std::string& name, const LLSD& val)
{
LLControlVariable* control = getControl(name);
if (control && control->isType(TYPE_LLSD))
{
setValue(name, val);
}
else
{
CONTROL_ERRS << "Invalid LLSD control " << name << llendl;
}
}
示例8: setString
void LLControlGroup::setString(const std::string& name, const std::string &val)
{
LLControlVariable* control = getControl(name);
if (control && control->isType(TYPE_STRING))
{
control->set(val);
}
else
{
CONTROL_ERRS << "Invalid control " << name << llendl;
}
}
示例9: getControl
void LLControlGroup::setF32(const std::string& name, F32 val)
{
LLControlVariable* control = getControl(name);
if (control && control->isType(TYPE_F32))
{
control->set(val);
if(mChangeCallback)
mChangeCallback(name,llformat("%f",val));
}
else
{
CONTROL_ERRS << "Invalid control " << name << llendl;
}
}
示例10: setRect
void LLControlGroup::setRect(const std::string& name, const LLRect &val)
{
LLControlVariable* control = getControl(name);
if (control && control->isType(TYPE_RECT))
{
control->set(val.getValue());
if(mChangeCallback)
mChangeCallback(name,llformat("[%f,%f,%f,%f]",val.mBottom,val.mLeft,val.mRight,val.mTop));
}
else
{
CONTROL_ERRS << "Invalid rect control " << name << llendl;
}
}
示例11: setBOOL
void LLControlGroup::setBOOL(const std::string& name, BOOL val)
{
LLControlVariable* control = getControl(name);
if (control && control->isType(TYPE_BOOLEAN))
{
control->set(val);
if(mChangeCallback)
mChangeCallback(name,(val) ? "1" : "0");
}
else
{
CONTROL_ERRS << "Invalid control " << name << llendl;
}
}
示例12: toggleControl
//static
void LLViewerControlListener::toggleControl(LLControlGroup * controls, LLSD const & event_data)
{
if(event_data.has("key"))
{
std::string key(event_data["key"]);
if(controls->controlExists(key))
{
LLControlVariable * control = controls->getControl(key);
if(control->isType(TYPE_BOOLEAN))
{
control->set(!control->get().asBoolean());
}
else
{
llwarns << "requested toggle of non-boolean control: \"" << key << "\", type is " << control->type() << llendl;
}
}
else
{
llwarns << "requested unknown control: \"" << key << '\"' << llendl;
}
}
}
示例13: 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;
}
}