summaryrefslogtreecommitdiff
path: root/indra/llcommon/llsdparam.cpp
diff options
context:
space:
mode:
authorRichard Linden <none@none>2012-10-19 19:35:01 -0700
committerRichard Linden <none@none>2012-10-19 19:35:01 -0700
commit176ffa54b44f2ef73f23e3252dd439f52fab3265 (patch)
treea261deb62bf993388805146119c15fadef917732 /indra/llcommon/llsdparam.cpp
parentbd52d784f904cb0b46be5826f6c7df31b214fc09 (diff)
SH-3405 WIP convert existing stats to lltrace system
finished most of conversion of llviewerassetstats ported some param block fixes from viewer-chui converted viewer asset stats to param block format
Diffstat (limited to 'indra/llcommon/llsdparam.cpp')
-rw-r--r--indra/llcommon/llsdparam.cpp45
1 files changed, 22 insertions, 23 deletions
diff --git a/indra/llcommon/llsdparam.cpp b/indra/llcommon/llsdparam.cpp
index 0e29873bb0..4b8a8dba5c 100644
--- a/indra/llcommon/llsdparam.cpp
+++ b/indra/llcommon/llsdparam.cpp
@@ -223,10 +223,14 @@ LLSD& LLParamSDParserUtilities::getSDWriteNode(LLSD& input, LLInitParam::Parser:
{
bool new_traversal = it->second;
- LLSD* child_sd = it->first.empty() ? sd_to_write : &(*sd_to_write)[it->first];
-
- if (child_sd->isArray())
+ LLSD* child_sd;
+ if (it->first.empty())
+ {
+ child_sd = sd_to_write;
+ if (child_sd->isUndefined())
{
+ *child_sd = LLSD::emptyArray();
+ }
if (new_traversal)
{
// write to new element at end
@@ -240,22 +244,7 @@ LLSD& LLParamSDParserUtilities::getSDWriteNode(LLSD& input, LLInitParam::Parser:
}
else
{
- if (new_traversal
- && child_sd->isDefined()
- && !child_sd->isArray())
- {
- // copy child contents into first element of an array
- LLSD new_array = LLSD::emptyArray();
- new_array.append(*child_sd);
- // assign array to slot that previously held the single value
- *child_sd = new_array;
- // return next element in that array
- sd_to_write = &((*child_sd)[1]);
- }
- else
- {
- sd_to_write = child_sd;
- }
+ sd_to_write = &(*sd_to_write)[it->first];
}
it->second = false;
}
@@ -283,8 +272,9 @@ void LLParamSDParserUtilities::readSDValues(read_sd_cb_t cb, const LLSD& sd, LLI
it != sd.endArray();
++it)
{
- stack.back().second = true;
+ stack.push_back(make_pair(std::string(), true));
readSDValues(cb, *it, stack);
+ stack.pop_back();
}
}
else if (sd.isUndefined())
@@ -315,6 +305,12 @@ namespace LLInitParam
// block param interface
bool ParamValue<LLSD, TypeValues<LLSD>, false>::deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack, bool new_name)
{
+ if (name_stack.first == name_stack.second
+ && p.readValue<LLSD>(mValue))
+ {
+ return true;
+ }
+
LLSD& sd = LLParamSDParserUtilities::getSDWriteNode(mValue, name_stack);
LLSD::String string;
@@ -335,8 +331,11 @@ namespace LLInitParam
void ParamValue<LLSD, TypeValues<LLSD>, false>::serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const BaseBlock* diff_block) const
{
- // read from LLSD value and serialize out to parser (which could be LLSD, XUI, etc)
- Parser::name_stack_t stack;
- LLParamSDParserUtilities::readSDValues(boost::bind(&serializeElement, boost::ref(p), _1, _2), mValue, stack);
+ // attempt to write LLSD out directly
+ if (!p.writeValue<LLSD>(mValue, name_stack))
+ {
+ // otherwise read from LLSD value and serialize out to parser (which could be LLSD, XUI, etc)
+ LLParamSDParserUtilities::readSDValues(boost::bind(&serializeElement, boost::ref(p), _1, _2), mValue, name_stack);
+ }
}
}