本文整理汇总了C++中LLSD::asInteger方法的典型用法代码示例。如果您正苦于以下问题:C++ LLSD::asInteger方法的具体用法?C++ LLSD::asInteger怎么用?C++ LLSD::asInteger使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLSD
的用法示例。
在下文中一共展示了LLSD::asInteger方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: teleport_request_callback
void LLAvatarActions::teleport_request_callback(const LLSD& notification, const LLSD& response)
{
S32 option;
if (response.isInteger())
{
option = response.asInteger();
}
else
{
option = LLNotificationsUtil::getSelectedOption(notification, response);
}
if (0 == option)
{
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_ImprovedInstantMessage);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
msg->nextBlockFast(_PREHASH_MessageBlock);
msg->addBOOLFast(_PREHASH_FromGroup, FALSE);
msg->addUUIDFast(_PREHASH_ToAgentID, notification["substitutions"]["uuid"] );
msg->addU8Fast(_PREHASH_Offline, IM_ONLINE);
msg->addU8Fast(_PREHASH_Dialog, IM_TELEPORT_REQUEST);
msg->addUUIDFast(_PREHASH_ID, LLUUID::null);
msg->addU32Fast(_PREHASH_Timestamp, NO_TIMESTAMP); // no timestamp necessary
std::string name;
LLAgentUI::buildFullname(name);
msg->addStringFast(_PREHASH_FromAgentName, name);
msg->addStringFast(_PREHASH_Message, response["message"]);
msg->addU32Fast(_PREHASH_ParentEstateID, 0);
msg->addUUIDFast(_PREHASH_RegionID, LLUUID::null);
msg->addVector3Fast(_PREHASH_Position, gAgent.getPositionAgent());
gMessageSystem->addBinaryDataFast(
_PREHASH_BinaryBucket,
EMPTY_BINARY_BUCKET,
EMPTY_BINARY_BUCKET_SIZE);
gAgent.sendReliableMessage();
}
}
示例2:
// static
bool LLNetMap::LLScaleMap::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
LLNetMap *self = mPtr;
S32 level = userdata.asInteger();
switch(level)
{
case 0:
self->setScale(MAP_SCALE_MIN);
break;
case 1:
self->setScale(MAP_SCALE_MID);
break;
case 2:
self->setScale(MAP_SCALE_MAX);
break;
default:
break;
}
return true;
}
示例3: convertCategoryFromLLSD
LLPathfindingLinkset::ENavMeshGenerationCategory LLPathfindingLinkset::convertCategoryFromLLSD(const LLSD &llsd)
{
ENavMeshGenerationCategory navMeshGenerationCategory;
llassert(llsd.isInteger());
switch (llsd.asInteger())
{
case LINKSET_CATEGORY_VALUE_IGNORE :
navMeshGenerationCategory = kNavMeshGenerationIgnore;
break;
case LINKSET_CATEGORY_VALUE_INCLUDE :
navMeshGenerationCategory = kNavMeshGenerationInclude;
break;
case LINKSET_CATEGORY_VALUE_EXCLUDE :
navMeshGenerationCategory = kNavMeshGenerationExclude;
break;
default :
navMeshGenerationCategory = kNavMeshGenerationIgnore;
llassert(0);
break;
}
return navMeshGenerationCategory;
}
示例4: setValue
void LLScrollbar::setValue(const LLSD& value)
{
setDocPos((S32) value.asInteger());
}
示例5: handleSliderScrollWheelMultiplierChanged
bool handleSliderScrollWheelMultiplierChanged(const LLSD& newvalue)
{
LLSlider::setScrollWheelMultiplier( newvalue.asInteger() );
return true;
}
示例6: format_impl
S32 LLSDXMLFormatter::format_impl(const LLSD& data, std::ostream& ostr, U32 options, U32 level) const
{
S32 format_count = 1;
std::string pre;
std::string post;
if (options & LLSDFormatter::OPTIONS_PRETTY)
{
for (U32 i = 0; i < level; i++)
{
pre += " ";
}
post = "\n";
}
switch(data.type())
{
case LLSD::TypeMap:
if(0 == data.size())
{
ostr << pre << "<map />" << post;
}
else
{
ostr << pre << "<map>" << post;
LLSD::map_const_iterator iter = data.beginMap();
LLSD::map_const_iterator end = data.endMap();
for(; iter != end; ++iter)
{
ostr << pre << "<key>" << escapeString((*iter).first) << "</key>" << post;
format_count += format_impl((*iter).second, ostr, options, level + 1);
}
ostr << pre << "</map>" << post;
}
break;
case LLSD::TypeArray:
if(0 == data.size())
{
ostr << pre << "<array />" << post;
}
else
{
ostr << pre << "<array>" << post;
LLSD::array_const_iterator iter = data.beginArray();
LLSD::array_const_iterator end = data.endArray();
for(; iter != end; ++iter)
{
format_count += format_impl(*iter, ostr, options, level + 1);
}
ostr << pre << "</array>" << post;
}
break;
case LLSD::TypeUndefined:
ostr << pre << "<undef />" << post;
break;
case LLSD::TypeBoolean:
ostr << pre << "<boolean>";
if(mBoolAlpha ||
(ostr.flags() & std::ios::boolalpha)
)
{
ostr << (data.asBoolean() ? "true" : "false");
}
else
{
ostr << (data.asBoolean() ? 1 : 0);
}
ostr << "</boolean>" << post;
break;
case LLSD::TypeInteger:
ostr << pre << "<integer>" << data.asInteger() << "</integer>" << post;
break;
case LLSD::TypeReal:
ostr << pre << "<real>";
if(mRealFormat.empty())
{
ostr << data.asReal();
}
else
{
formatReal(data.asReal(), ostr);
}
ostr << "</real>" << post;
break;
case LLSD::TypeUUID:
if(data.asUUID().isNull()) ostr << pre << "<uuid />" << post;
else ostr << pre << "<uuid>" << data.asUUID() << "</uuid>" << post;
break;
case LLSD::TypeString:
if(data.asStringRef().empty()) ostr << pre << "<string />" << post;
else ostr << pre << "<string>" << escapeString(data.asStringRef()) <<"</string>" << post;
break;
//.........这里部分代码省略.........
示例7:
void LLFilterSD2XMLRPC::streamOut(std::ostream& ostr, const LLSD& sd)
{
ostr << "<value>";
switch(sd.type())
{
case LLSD::TypeMap:
{
#if LL_SPEW_STREAM_OUT_DEBUGGING
llinfos << "streamOut(map) BEGIN" << llendl;
#endif
ostr << "<struct>";
if(ostr.fail())
{
llinfos << "STREAM FAILURE writing struct" << llendl;
}
LLSD::map_const_iterator it = sd.beginMap();
LLSD::map_const_iterator end = sd.endMap();
for(; it != end; ++it)
{
ostr << "<member><name>" << xml_escape_string((*it).first)
<< "</name>";
streamOut(ostr, (*it).second);
if(ostr.fail())
{
llinfos << "STREAM FAILURE writing '" << (*it).first
<< "' with sd type " << (*it).second.type() << llendl;
}
ostr << "</member>";
}
ostr << "</struct>";
#if LL_SPEW_STREAM_OUT_DEBUGGING
llinfos << "streamOut(map) END" << llendl;
#endif
break;
}
case LLSD::TypeArray:
{
#if LL_SPEW_STREAM_OUT_DEBUGGING
llinfos << "streamOut(array) BEGIN" << llendl;
#endif
ostr << "<array><data>";
LLSD::array_const_iterator it = sd.beginArray();
LLSD::array_const_iterator end = sd.endArray();
for(; it != end; ++it)
{
streamOut(ostr, *it);
if(ostr.fail())
{
llinfos << "STREAM FAILURE writing array element sd type "
<< (*it).type() << llendl;
}
}
#if LL_SPEW_STREAM_OUT_DEBUGGING
llinfos << "streamOut(array) END" << llendl;
#endif
ostr << "</data></array>";
break;
}
case LLSD::TypeUndefined:
// treat undefined as a bool with a false value.
case LLSD::TypeBoolean:
#if LL_SPEW_STREAM_OUT_DEBUGGING
llinfos << "streamOut(bool)" << llendl;
#endif
ostr << "<boolean>" << (sd.asBoolean() ? "1" : "0") << "</boolean>";
break;
case LLSD::TypeInteger:
#if LL_SPEW_STREAM_OUT_DEBUGGING
llinfos << "streamOut(int)" << llendl;
#endif
ostr << "<i4>" << sd.asInteger() << "</i4>";
break;
case LLSD::TypeReal:
#if LL_SPEW_STREAM_OUT_DEBUGGING
llinfos << "streamOut(real)" << llendl;
#endif
ostr << "<double>" << sd.asReal() << "</double>";
break;
case LLSD::TypeString:
#if LL_SPEW_STREAM_OUT_DEBUGGING
llinfos << "streamOut(string)" << llendl;
#endif
ostr << "<string>" << xml_escape_string(sd.asString()) << "</string>";
break;
case LLSD::TypeUUID:
#if LL_SPEW_STREAM_OUT_DEBUGGING
llinfos << "streamOut(uuid)" << llendl;
#endif
// serialize it as a string
ostr << "<string>" << sd.asString() << "</string>";
break;
case LLSD::TypeURI:
{
#if LL_SPEW_STREAM_OUT_DEBUGGING
llinfos << "streamOut(uri)" << llendl;
#endif
// serialize it as a string
ostr << "<string>" << xml_escape_string(sd.asString()) << "</string>";
break;
}
//.........这里部分代码省略.........
示例8: format
// virtual
S32 LLSDNotationFormatter::format(const LLSD& data, std::ostream& ostr, U32 options) const
{
S32 format_count = 1;
switch(data.type())
{
case LLSD::TypeMap:
{
ostr << "{";
bool need_comma = false;
LLSD::map_const_iterator iter = data.beginMap();
LLSD::map_const_iterator end = data.endMap();
for(; iter != end; ++iter)
{
if(need_comma) ostr << ",";
need_comma = true;
ostr << '\'';
serialize_string((*iter).first, ostr);
ostr << "':";
format_count += format((*iter).second, ostr);
}
ostr << "}";
break;
}
case LLSD::TypeArray:
{
ostr << "[";
bool need_comma = false;
LLSD::array_const_iterator iter = data.beginArray();
LLSD::array_const_iterator end = data.endArray();
for(; iter != end; ++iter)
{
if(need_comma) ostr << ",";
need_comma = true;
format_count += format(*iter, ostr);
}
ostr << "]";
break;
}
case LLSD::TypeUndefined:
ostr << "!";
break;
case LLSD::TypeBoolean:
if(mBoolAlpha ||
#if( LL_WINDOWS || LL_MINGW32 || __GNUC__ > 2)
(ostr.flags() & std::ios::boolalpha)
#else
(ostr.flags() & 0x0100)
#endif
)
{
ostr << (data.asBoolean()
? NOTATION_TRUE_SERIAL : NOTATION_FALSE_SERIAL);
}
else
{
ostr << (data.asBoolean() ? 1 : 0);
}
break;
case LLSD::TypeInteger:
ostr << "i" << data.asInteger();
break;
case LLSD::TypeReal:
ostr << "r";
if(mRealFormat.empty())
{
ostr << data.asReal();
}
else
{
formatReal(data.asReal(), ostr);
}
break;
case LLSD::TypeUUID:
ostr << "u" << data.asUUID();
break;
case LLSD::TypeString:
ostr << '\'';
serialize_string(data.asString(), ostr);
ostr << '\'';
break;
case LLSD::TypeDate:
ostr << "d\"" << data.asDate() << "\"";
break;
case LLSD::TypeURI:
ostr << "l\"";
serialize_string(data.asString(), ostr);
ostr << "\"";
break;
case LLSD::TypeBinary:
//.........这里部分代码省略.........
示例9: handleMaxPartCountChanged
static bool handleMaxPartCountChanged(const LLSD& newvalue)
{
LLViewerPartSim::setMaxPartCount(newvalue.asInteger());
return true;
}
示例10: format_impl
S32 LLSDXMLFormatter::format_impl(const LLSD& data, std::ostream& ostr, U32 options, U32 level) const
{
S32 format_count = 1;
std::string pre;
std::string post;
if (options & LLSDFormatter::OPTIONS_PRETTY)
{
for (U32 i = 0; i < level; i++)
{
pre += " ";
}
post = "\n";
}
switch(data.type())
{
case LLSD::TypeMap:
if(0 == data.size())
{
ostr << pre << "<map />" << post;
}
else
{
ostr << pre << "<map>" << post;
LLSD::map_const_iterator iter = data.beginMap();
LLSD::map_const_iterator end = data.endMap();
for(; iter != end; ++iter)
{
ostr << pre << "<key>" << escapeString((*iter).first) << "</key>" << post;
format_count += format_impl((*iter).second, ostr, options, level + 1);
}
ostr << pre << "</map>" << post;
}
break;
case LLSD::TypeArray:
if(0 == data.size())
{
ostr << pre << "<array />" << post;
}
else
{
ostr << pre << "<array>" << post;
LLSD::array_const_iterator iter = data.beginArray();
LLSD::array_const_iterator end = data.endArray();
for(; iter != end; ++iter)
{
format_count += format_impl(*iter, ostr, options, level + 1);
}
ostr << pre << "</array>" << post;
}
break;
case LLSD::TypeUndefined:
ostr << pre << "<undef />" << post;
break;
case LLSD::TypeBoolean:
ostr << pre << "<boolean>";
if(mBoolAlpha ||
#if( LL_WINDOWS || __GNUC__ > 2)
(ostr.flags() & std::ios::boolalpha)
#else
(ostr.flags() & 0x0100)
#endif
)
{
ostr << (data.asBoolean() ? "true" : "false");
}
else
{
ostr << (data.asBoolean() ? 1 : 0);
}
ostr << "</boolean>" << post;
break;
case LLSD::TypeInteger:
ostr << pre << "<integer>" << data.asInteger() << "</integer>" << post;
break;
case LLSD::TypeReal:
ostr << pre << "<real>";
if(mRealFormat.empty())
{
ostr << data.asReal();
}
else
{
formatReal(data.asReal(), ostr);
}
ostr << "</real>" << post;
break;
case LLSD::TypeUUID:
if(data.asUUID().isNull()) ostr << pre << "<uuid />" << post;
else ostr << pre << "<uuid>" << data.asUUID() << "</uuid>" << post;
break;
case LLSD::TypeString:
//.........这里部分代码省略.........
示例11: onTeleportHistoryMenuItemClicked
void LLNavigationBar::onTeleportHistoryMenuItemClicked(const LLSD& userdata)
{
int idx = userdata.asInteger();
LLTeleportHistory::getInstance()->goToItem(idx);
}
示例12:
template <> void jc_rebind::rebind_callback<U32>(const LLSD &data, U32 *reciever){ *reciever = data.asInteger(); }
示例13: load
BOOL LLEventNotification::load(const LLSD& response)
{
BOOL event_ok = TRUE;
LLSD option = response.get("event_id");
if (option.isDefined())
{
mEventID = option.asInteger();
}
else
{
event_ok = FALSE;
}
option = response.get("event_name");
if (option.isDefined())
{
llinfos << "Event: " << option.asString() << llendl;
mEventName = option.asString();
}
else
{
event_ok = FALSE;
}
option = response.get("event_date");
if (option.isDefined())
{
llinfos << "EventDate: " << option.asString() << llendl;
mEventDateStr = option.asString();
}
else
{
event_ok = FALSE;
}
option = response.get("event_date_ut");
if (option.isDefined())
{
llinfos << "EventDate: " << option.asString() << llendl;
mEventDate = strtoul(option.asString().c_str(), NULL, 10);
}
else
{
event_ok = FALSE;
}
S32 grid_x = 0;
S32 grid_y = 0;
S32 x_region = 0;
S32 y_region = 0;
option = response.get("grid_x");
if (option.isDefined())
{
llinfos << "GridX: " << option.asInteger() << llendl;
grid_x= option.asInteger();
}
else
{
event_ok = FALSE;
}
option = response.get("grid_y");
if (option.isDefined())
{
llinfos << "GridY: " << option.asInteger() << llendl;
grid_y = option.asInteger();
}
else
{
event_ok = FALSE;
}
option = response.get("x_region");
if (option.isDefined())
{
llinfos << "RegionX: " << option.asInteger() << llendl;
x_region = option.asInteger();
}
else
{
event_ok = FALSE;
}
option = response.get("y_region");
if (option.isDefined())
{
llinfos << "RegionY: " << option.asInteger() << llendl;
y_region = option.asInteger();
}
else
{
event_ok = FALSE;
}
mEventPosGlobal.mdV[VX] = grid_x * 256 + x_region;
mEventPosGlobal.mdV[VY] = grid_y * 256 + y_region;
mEventPosGlobal.mdV[VZ] = 0.f;
return event_ok;
//.........这里部分代码省略.........
示例14:
void LLSavedSettingsGlue::setU32(LLUICtrl* ctrl, void* data)
{
const char* name = (const char*)data;
LLSD value = ctrl->getValue();
gSavedSettings.setU32(name, (U32)value.asInteger());
}
示例15: handleTerrainDetailChanged
static bool handleTerrainDetailChanged(const LLSD& newvalue)
{
LLDrawPoolTerrain::sDetailMode = newvalue.asInteger();
return true;
}