diff options
Diffstat (limited to 'indra/llui/llsdparam.cpp')
-rw-r--r-- | indra/llui/llsdparam.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/indra/llui/llsdparam.cpp b/indra/llui/llsdparam.cpp index f97f80ab6c..fae20a473e 100644 --- a/indra/llui/llsdparam.cpp +++ b/indra/llui/llsdparam.cpp @@ -45,6 +45,7 @@ LLParamSDParser::LLParamSDParser() if (sReadFuncs.empty()) { + registerParserFuncs<LLInitParam::NoValue>(readNoValue, &LLParamSDParser::writeNoValue); registerParserFuncs<S32>(readS32, &LLParamSDParser::writeTypedValue<S32>); registerParserFuncs<U32>(readU32, &LLParamSDParser::writeU32Param); registerParserFuncs<F32>(readF32, &LLParamSDParser::writeTypedValue<F32>); @@ -71,6 +72,18 @@ bool LLParamSDParser::writeU32Param(LLParamSDParser::parser_t& parser, const voi return true; } +bool LLParamSDParser::writeNoValue(LLParamSDParser::parser_t& parser, const void* val_ptr, const parser_t::name_stack_t& name_stack) +{ + LLParamSDParser& sdparser = static_cast<LLParamSDParser&>(parser); + if (!sdparser.mWriteRootSD) return false; + + LLSD* sd_to_write = sdparser.getSDWriteNode(name_stack); + if (!sd_to_write) return false; + + return true; +} + + void LLParamSDParser::readSD(const LLSD& sd, LLInitParam::BaseBlock& block, bool silent) { mCurReadSD = NULL; @@ -87,6 +100,8 @@ void LLParamSDParser::writeSD(LLSD& sd, const LLInitParam::BaseBlock& block) block.serializeBlock(*this); } +const LLSD NO_VALUE_MARKER; + void LLParamSDParser::readSDValues(const LLSD& sd, LLInitParam::BaseBlock& block) { if (sd.isMap()) @@ -110,6 +125,11 @@ void LLParamSDParser::readSDValues(const LLSD& sd, LLInitParam::BaseBlock& block readSDValues(*it, block); } } + else if (sd.isUndefined()) + { + mCurReadSD = &NO_VALUE_MARKER; + block.submitValue(mNameStack, *this); + } else { mCurReadSD = &sd; @@ -206,6 +226,13 @@ LLSD* LLParamSDParser::getSDWriteNode(const parser_t::name_stack_t& name_stack) return sd_to_write; } +bool LLParamSDParser::readNoValue(Parser& parser, void* val_ptr) +{ + LLParamSDParser& self = static_cast<LLParamSDParser&>(parser); + return self.mCurReadSD == &NO_VALUE_MARKER; +} + + bool LLParamSDParser::readS32(Parser& parser, void* val_ptr) { LLParamSDParser& self = static_cast<LLParamSDParser&>(parser); |