diff options
Diffstat (limited to 'indra/llxuixml/llinitparam.cpp')
-rw-r--r-- | indra/llxuixml/llinitparam.cpp | 87 |
1 files changed, 20 insertions, 67 deletions
diff --git a/indra/llxuixml/llinitparam.cpp b/indra/llxuixml/llinitparam.cpp index 8d6aa405e2..2c92539387 100644 --- a/indra/llxuixml/llinitparam.cpp +++ b/indra/llxuixml/llinitparam.cpp @@ -3,31 +3,25 @@ * @brief parameter block abstraction for creating complex objects and * parsing construction parameters from xml and LLSD * - * $LicenseInfo:firstyear=2008&license=viewergpl$ - * - * Copyright (c) 2008-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2008&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * Copyright (C) 2010, Linden Research, Inc. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -74,7 +68,6 @@ namespace LLInitParam void BlockDescriptor::aggregateBlockData(BlockDescriptor& src_block_data) { mNamedParams.insert(src_block_data.mNamedParams.begin(), src_block_data.mNamedParams.end()); - mSynonyms.insert(src_block_data.mSynonyms.begin(), src_block_data.mSynonyms.end()); std::copy(src_block_data.mUnnamedParams.begin(), src_block_data.mUnnamedParams.end(), std::back_inserter(mUnnamedParams)); std::copy(src_block_data.mValidationList.begin(), src_block_data.mValidationList.end(), std::back_inserter(mValidationList)); std::copy(src_block_data.mAllParams.begin(), src_block_data.mAllParams.end(), std::back_inserter(mAllParams)); @@ -84,8 +77,7 @@ namespace LLInitParam // BaseBlock // BaseBlock::BaseBlock() - : mChangeVersion(0), - mBlockDescriptor(NULL) + : mChangeVersion(0) {} BaseBlock::~BaseBlock() @@ -94,8 +86,6 @@ namespace LLInitParam // called by each derived class in least to most derived order void BaseBlock::init(BlockDescriptor& descriptor, BlockDescriptor& base_descriptor, size_t block_size) { - mBlockDescriptor = &descriptor; - descriptor.mCurrentBlockPtr = this; descriptor.mMaxParamOffset = block_size; @@ -188,7 +178,7 @@ namespace LLInitParam param_handle_t param_handle = it->second->mParamHandle; const Param* param = getParamFromHandle(param_handle); ParamDescriptor::serialize_func_t serialize_func = it->second->mSerializeFunc; - if (serialize_func) + if (serialize_func && param->anyProvided()) { // Ensure this param has not already been serialized // Prevents <rect> from being serialized as its own tag. @@ -280,22 +270,6 @@ namespace LLInitParam } } - for(BlockDescriptor::param_map_t::const_iterator it = block_data.mSynonyms.begin(); - it != block_data.mSynonyms.end(); - ++it) - { - param_handle_t param_handle = it->second->mParamHandle; - const Param* param = getParamFromHandle(param_handle); - ParamDescriptor::inspect_func_t inspect_func = it->second->mInspectFunc; - if (inspect_func) - { - // use existing serial number for param - name_stack.push_back(std::make_pair(it->first, it->second->mGeneration)); - inspect_func(*param, parser, name_stack, it->second->mMinCount, it->second->mMaxCount); - name_stack.pop_back(); - } - } - return true; } @@ -317,22 +291,9 @@ namespace LLInitParam // find pointer to member parameter from offset table paramp = getParamFromHandle(found_it->second->mParamHandle); deserialize_func = found_it->second->mDeserializeFunc; - } - else - { - BlockDescriptor::param_map_t::iterator found_it = block_data.mSynonyms.find(top_name); - if (found_it != block_data.mSynonyms.end()) - { - // find pointer to member parameter from offset table - paramp = getParamFromHandle(found_it->second->mParamHandle); - deserialize_func = found_it->second->mDeserializeFunc; - } - } - Parser::name_stack_range_t new_name_stack(name_stack.first, name_stack.second); - ++new_name_stack.first; - if (deserialize_func) - { + Parser::name_stack_range_t new_name_stack(name_stack.first, name_stack.second); + ++new_name_stack.first; return deserialize_func(*paramp, p, new_name_stack, name_stack.first == name_stack.second ? -1 : name_stack.first->second); } } @@ -407,7 +368,7 @@ namespace LLInitParam } else { - block_data.mSynonyms[synonym] = param_descriptor; + block_data.mNamedParams[synonym] = param_descriptor; } } } @@ -432,14 +393,6 @@ namespace LLInitParam } } - for (BlockDescriptor::param_map_t::const_iterator it = block_data.mSynonyms.begin(); it != block_data.mSynonyms.end(); ++it) - { - if (it->second->mParamHandle == handle) - { - return it->first; - } - } - return LLStringUtil::null; } |