本文整理汇总了C++中declareControl函数的典型用法代码示例。如果您正苦于以下问题:C++ declareControl函数的具体用法?C++ declareControl怎么用?C++ declareControl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了declareControl函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: declareControl
BOOL LLControlGroup::declareBOOL(const std::string& name, const BOOL initial_val, const std::string& comment, BOOL persist)
{
return declareControl(name, TYPE_BOOLEAN, initial_val, comment, persist);
}
开发者ID:9skunks,项目名称:imprudence,代码行数:4,代码来源:llcontrol.cpp
示例2: declareControl
BOOL LLControlGroup::declareLLSD(const std::string& name, const LLSD &initial_val, const std::string& comment, BOOL persist )
{
return declareControl(name, TYPE_LLSD, initial_val, comment, persist);
}
开发者ID:N3X15,项目名称:Luna-Viewer,代码行数:4,代码来源:llcontrol.cpp
示例3: loadFromFileLegacy
//.........这里部分代码省略.........
if (ret <= 0)
{
infile.close();
llwarns << "Unable to open LLSD control file " << filename << ". Trying Legacy Method." << llendl;
return loadFromFileLegacy(filename, TRUE, TYPE_STRING);
}
U32 validitems = 0;
bool hidefromsettingseditor = false;
for(LLSD::map_const_iterator itr = settings.beginMap(); itr != settings.endMap(); ++itr)
{
bool persist = true;
name = (*itr).first;
control_map = (*itr).second;
if(control_map.has("Persist"))
{
persist = control_map["Persist"].asInteger();
}
// Sometimes we want to use the settings system to provide cheap persistence, but we
// don't want the settings themselves to be easily manipulated in the UI because
// doing so can cause support problems. So we have this option:
// To actually only hide adult settings and the world search url.
// Upside of the latter is that it also makes it harder to use the viewer with OpenSim.
// And teenagers never would dare ever to touch the settings.xml file.
//
// For it's anyway useful to be able to change them we should add in future
// a possibility to unhide them again, e.g. typing "I'm up to no good" to channel 666,
// tripple-rightclick the avatars nose and then play a "I will tell your MUM that you
// changed ADULT setting in the DEBUG MENU!" gesture in world.
//
/*
if(control_map.has("HideFromEditor"))
{
hidefromsettingseditor = control_map["HideFromEditor"].asInteger();
}
else
{
hidefromsettingseditor = false;
}
*/
// [RLVa:KB] - Checked: 2010-06-20 (RLVa-1.1.2a) | Added: RLVa-1.1.2a
// HACK-RLVa: bad code but it's just a temporary measure to provide a smooth changeover from the old to the new rebranded settings
if ( (name.length() >= 14) && (0 == name.find("RestrainedLife")) )
{
// Transparently convert the old settings name to the new one while preserving the user override
name = "RestrainedLove" + name.substr(14);
}
// [/RLVa:KB]
// If the control exists just set the value from the input file.
LLControlVariable* existing_control = getControl(name);
if(existing_control)
{
if(set_default_values)
{
// Override all previously set properties of this control.
// ... except for type. The types must match.
eControlType new_type = typeStringToEnum(control_map["Type"].asString());
if(existing_control->isType(new_type))
{
existing_control->setDefaultValue(control_map["Value"]);
existing_control->setPersist(persist);
existing_control->setHiddenFromSettingsEditor(hidefromsettingseditor);
existing_control->setComment(control_map["Comment"].asString());
}
else
{
llerrs << "Mismatched type of control variable '"
<< name << "' found while loading '"
<< filename << "'." << llendl;
}
}
else if(existing_control->isPersisted())
{
existing_control->setValue(control_map["Value"]);
}
// *NOTE: If not persisted and not setting defaults,
// the value should not get loaded.
}
else
{
declareControl(name,
typeStringToEnum(control_map["Type"].asString()),
control_map["Value"],
control_map["Comment"].asString(),
persist,
hidefromsettingseditor
);
}
++validitems;
}
return validitems;
}
开发者ID:9skunks,项目名称:imprudence,代码行数:101,代码来源:llcontrol.cpp
示例4: loadFromFileLegacy
U32 LLControlGroup::loadFromFile(const std::string& filename, bool set_default_values)
{
std::string name;
LLSD settings;
LLSD control_map;
llifstream infile;
infile.open(filename);
if(!infile.is_open())
{
llwarns << "Cannot find file " << filename << " to load." << llendl;
return 0;
}
S32 ret = LLSDSerialize::fromXML(settings, infile);
if (ret <= 0)
{
infile.close();
llwarns << "Unable to open LLSD control file " << filename << ". Trying Legacy Method." << llendl;
return loadFromFileLegacy(filename, TRUE, TYPE_STRING);
}
U32 validitems = 0;
bool persist = false;
for(LLSD::map_const_iterator itr = settings.beginMap(); itr != settings.endMap(); ++itr)
{
name = (*itr).first;
control_map = (*itr).second;
if(control_map.has("Persist"))
{
persist = control_map["Persist"].asInteger();
}
// If the control exists just set the value from the input file.
LLControlVariable* existing_control = getControl(name);
if(existing_control)
{
if(set_default_values)
{
// Override all previously set properties of this control.
// ... except for type. The types must match.
eControlType new_type = typeStringToEnum(control_map["Type"].asString());
if(existing_control->isType(new_type))
{
existing_control->setDefaultValue(control_map["Value"]);
existing_control->setPersist(persist);
existing_control->setComment(control_map["Comment"].asString());
}
else
{
llerrs << "Mismatched type of control variable '"
<< name << "' found while loading '"
<< filename << "'." << llendl;
}
}
else if(existing_control->isPersisted())
{
existing_control->setValue(control_map["Value"]);
}
// *NOTE: If not persisted and not setting defaults,
// the value should not get loaded.
}
else
{
declareControl(name,
typeStringToEnum(control_map["Type"].asString()),
control_map["Value"],
control_map["Comment"].asString(),
persist
);
}
++validitems;
}
return validitems;
}
开发者ID:Rezzable,项目名称:heritagekey-viewer,代码行数:79,代码来源:llcontrol.cpp
示例5: declareControl
BOOL LLControlGroup::declareColor4(const std::string& name, const LLColor4 &initial_val, const std::string& comment, BOOL persist )
{
return declareControl(name, TYPE_COL4, initial_val.getValue(), comment, SANITY_TYPE_NONE, LLSD(), std::string(""), persist);
}
开发者ID:wish-ds,项目名称:firestorm-ds,代码行数:4,代码来源:llcontrol.cpp
示例6: LL_WARNS
//.........这里部分代码省略.........
// doing so can cause support problems. So we have this option:
if(control_map.has("HideFromEditor"))
{
hidefromsettingseditor = control_map["HideFromEditor"].asInteger();
}
else
{
hidefromsettingseditor = false;
}
// If the control exists just set the value from the input file.
LLControlVariable* existing_control = getControl(name);
if(existing_control)
{
// set_default_values is true when we're loading the initial,
// immutable files from app_settings, e.g. settings.xml.
if(set_default_values)
{
// Override all previously set properties of this control.
// ... except for type. The types must match.
eControlType new_type = typeStringToEnum(control_map["Type"].asString());
if(existing_control->isType(new_type))
{
existing_control->setDefaultValue(control_map["Value"]);
existing_control->setPersist(persist);
existing_control->setHiddenFromSettingsEditor(hidefromsettingseditor);
existing_control->setComment(control_map["Comment"].asString());
existing_control->setBackupable(can_backup); // <FS:Zi> Backup Settings
}
else
{
LL_ERRS() << "Mismatched type of control variable '"
<< name << "' found while loading '"
<< filename << "'." << LL_ENDL;
}
}
else if(existing_control->isPersisted())
{
// save_values is specifically false for (e.g.)
// SessionSettingsFile and UserSessionSettingsFile -- in other
// words, for a file that's supposed to be transient.
existing_control->setValue(control_map["Value"], save_values);
}
// *NOTE: If not persisted and not setting defaults,
// the value should not get loaded.
}
else
{
// We've never seen this control before. Either we're loading up
// the initial set of default settings files (set_default_values)
// -- or we're loading user settings last saved by a viewer that
// supports a superset of the variables we know.
// CHOP-962: if we're loading an unrecognized user setting, make
// sure we save it later. If you try an experimental viewer, tweak
// a new setting, briefly revert to an old viewer, then return to
// the new one, we don't want the old viewer to discard the
// setting you changed.
if (! set_default_values)
{
// Using PERSIST_ALWAYS insists that saveToFile() (which calls
// LLControlVariable::shouldSave()) must save this control
// variable regardless of its value. We can safely set this
// LLControlVariable persistent because the 'persistent' flag
// is not itself persisted!
persist = LLControlVariable::PERSIST_ALWAYS;
// We want to mention unrecognized user settings variables
// (e.g. from a newer version of the viewer) in the log. But
// we also arrive here for Boolean variables generated by
// the notifications subsystem when the user checks "Don't
// show me this again." These aren't declared in settings.xml;
// they're actually named for the notification they suppress.
// We don't want to mention those. Apologies, this is a bit of
// a hack: we happen to know that user settings go into an
// LLControlGroup whose name is "Global".
if (getKey() == "Global")
{
LL_INFOS("LLControlGroup") << "preserving unrecognized " << getKey()
<< " settings variable " << name << LL_ENDL;
}
}
declareControl(name,
typeStringToEnum(control_map["Type"].asString()),
control_map["Value"],
control_map["Comment"].asString(),
sanityTypeStringToEnum(control_map["SanityCheckType"].asString()),
control_map["SanityValue"],
control_map["SanityComment"].asString(),
persist,
can_backup, // <FS:Zi> Backup Settings
hidefromsettingseditor
);
}
++validitems;
}
LL_DEBUGS("Settings") << "Loaded " << validitems << " settings from " << filename << LL_ENDL;
return validitems;
}
开发者ID:CaseyraeStarfinder,项目名称:Firestorm-Viewer,代码行数:101,代码来源:llcontrol.cpp
示例7: loadFromFileLegacy
U32 LLControlGroup::loadFromFile(const std::string& filename, bool set_default_values, bool save_values)
{
LLSD settings;
llifstream infile;
infile.open(filename);
if(!infile.is_open())
{
llwarns << "Cannot find file " << filename << " to load." << llendl;
return 0;
}
S32 ret = LLSDSerialize::fromXML(settings, infile);
if (ret <= 0)
{
infile.close();
llwarns << "Unable to open LLSD control file " << filename << ". Trying Legacy Method." << llendl;
return loadFromFileLegacy(filename, TRUE, TYPE_STRING);
}
U32 validitems = 0;
bool hidefromsettingseditor = false;
for(LLSD::map_const_iterator itr = settings.beginMap(); itr != settings.endMap(); ++itr)
{
bool persist = true;
std::string const & name = itr->first;
LLSD const & control_map = itr->second;
if(control_map.has("Persist"))
{
persist = control_map["Persist"].asInteger();
}
// Sometimes we want to use the settings system to provide cheap persistence, but we
// don't want the settings themselves to be easily manipulated in the UI because
// doing so can cause support problems. So we have this option:
if(control_map.has("HideFromEditor"))
{
hidefromsettingseditor = control_map["HideFromEditor"].asInteger();
}
else
{
hidefromsettingseditor = false;
}
// If the control exists just set the value from the input file.
LLControlVariable* existing_control = getControl(name);
if(existing_control)
{
if(set_default_values)
{
// Override all previously set properties of this control.
// ... except for type. The types must match.
eControlType new_type = typeStringToEnum(control_map["Type"].asString());
if(existing_control->isType(new_type))
{
existing_control->setDefaultValue(control_map["Value"]);
existing_control->setPersist(persist);
existing_control->setHiddenFromSettingsEditor(hidefromsettingseditor);
existing_control->setComment(control_map["Comment"].asString());
}
else
{
llerrs << "Mismatched type of control variable '"
<< name << "' found while loading '"
<< filename << "'." << llendl;
}
}
else if(existing_control->isPersisted())
{
existing_control->setValue(control_map["Value"], save_values);
}
// *NOTE: If not persisted and not setting defaults,
// the value should not get loaded.
}
else
{
declareControl(name,
typeStringToEnum(control_map["Type"].asString()),
control_map["Value"],
control_map["Comment"].asString(),
persist,
hidefromsettingseditor
);
}
++validitems;
}
return validitems;
}
开发者ID:HizWylder,项目名称:GIS,代码行数:92,代码来源:llcontrol.cpp
示例8: declareControl
LLControlVariable* LLControlGroup::declareLLSD(const std::string& name, const LLSD &initial_val, const std::string& comment, LLControlVariable::ePersist persist )
{
return declareControl(name, TYPE_LLSD, initial_val, comment, SANITY_TYPE_NONE, LLSD(), std::string(""), persist);
}
开发者ID:CaseyraeStarfinder,项目名称:Firestorm-Viewer,代码行数:4,代码来源:llcontrol.cpp
注:本文中的declareControl函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论