diff options
Diffstat (limited to 'indra/llxuixml')
-rw-r--r-- | indra/llxuixml/llinitparam.cpp | 58 | ||||
-rw-r--r-- | indra/llxuixml/llinitparam.h | 208 | ||||
-rw-r--r-- | indra/llxuixml/llregistry.h | 36 | ||||
-rw-r--r-- | indra/llxuixml/lltrans.cpp | 36 | ||||
-rw-r--r-- | indra/llxuixml/lltrans.h | 36 | ||||
-rw-r--r-- | indra/llxuixml/lluicolor.cpp | 21 | ||||
-rw-r--r-- | indra/llxuixml/lluicolor.h | 21 | ||||
-rw-r--r-- | indra/llxuixml/llxuiparser.cpp | 36 | ||||
-rw-r--r-- | indra/llxuixml/llxuiparser.h | 36 |
9 files changed, 251 insertions, 237 deletions
diff --git a/indra/llxuixml/llinitparam.cpp b/indra/llxuixml/llinitparam.cpp index 2ead5a4a57..0b324a10c9 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. + * + * 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. * - * 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 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. * - * 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. + * 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 * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -139,7 +133,7 @@ namespace LLInitParam bool BaseBlock::validateBlock(bool emit_errors) const { - const BlockDescriptor& block_data = getBlockDescriptor(); + const BlockDescriptor& block_data = mostDerivedBlockDescriptor(); for (BlockDescriptor::param_validation_list_t::const_iterator it = block_data.mValidationList.begin(); it != block_data.mValidationList.end(); ++it) { const Param* param = getParamFromHandle(it->first); @@ -159,7 +153,7 @@ namespace LLInitParam { // named param is one like LLView::Params::follows // unnamed param is like LLView::Params::rect - implicit - const BlockDescriptor& block_data = getBlockDescriptor(); + const BlockDescriptor& block_data = mostDerivedBlockDescriptor(); for (BlockDescriptor::param_list_t::const_iterator it = block_data.mUnnamedParams.begin(); it != block_data.mUnnamedParams.end(); @@ -230,7 +224,7 @@ namespace LLInitParam { // named param is one like LLView::Params::follows // unnamed param is like LLView::Params::rect - implicit - const BlockDescriptor& block_data = getBlockDescriptor(); + const BlockDescriptor& block_data = mostDerivedBlockDescriptor(); for (BlockDescriptor::param_list_t::const_iterator it = block_data.mUnnamedParams.begin(); it != block_data.mUnnamedParams.end(); @@ -301,7 +295,7 @@ namespace LLInitParam bool BaseBlock::deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack) { - BlockDescriptor& block_data = getBlockDescriptor(); + BlockDescriptor& block_data = mostDerivedBlockDescriptor(); bool names_left = name_stack.first != name_stack.second; if (names_left) @@ -386,7 +380,7 @@ namespace LLInitParam void BaseBlock::addSynonym(Param& param, const std::string& synonym) { - BlockDescriptor& block_data = getBlockDescriptor(); + BlockDescriptor& block_data = mostDerivedBlockDescriptor(); if (block_data.mInitializationState == BlockDescriptor::INITIALIZING) { param_handle_t handle = getHandleFromParam(¶m); @@ -417,8 +411,8 @@ namespace LLInitParam { if (user_provided) { - mChangeVersion++; - } + mChangeVersion++; + } } const std::string& BaseBlock::getParamName(const BlockDescriptor& block_data, const Param* paramp) const @@ -445,7 +439,7 @@ namespace LLInitParam ParamDescriptor* BaseBlock::findParamDescriptor(param_handle_t handle) { - BlockDescriptor& descriptor = getBlockDescriptor(); + BlockDescriptor& descriptor = mostDerivedBlockDescriptor(); BlockDescriptor::all_params_list_t::iterator end_it = descriptor.mAllParams.end(); for (BlockDescriptor::all_params_list_t::iterator it = descriptor.mAllParams.begin(); it != end_it; @@ -460,7 +454,7 @@ namespace LLInitParam // NOTE: this requires that "other" is of the same derived type as this bool BaseBlock::merge(BlockDescriptor& block_data, const BaseBlock& other, bool overwrite) { - bool param_changed = false; + bool some_param_changed = false; BlockDescriptor::all_params_list_t::const_iterator end_it = block_data.mAllParams.end(); for (BlockDescriptor::all_params_list_t::const_iterator it = block_data.mAllParams.begin(); it != end_it; @@ -471,10 +465,10 @@ namespace LLInitParam if (merge_func) { Param* paramp = getParamFromHandle(it->mParamHandle); - param_changed |= merge_func(*paramp, *other_paramp, overwrite); + some_param_changed |= merge_func(*paramp, *other_paramp, overwrite); } } - return param_changed; + return some_param_changed; } bool ParamCompare<LLSD, false>::equals(const LLSD &a, const LLSD &b) diff --git a/indra/llxuixml/llinitparam.h b/indra/llxuixml/llinitparam.h index c9c1d4af90..869b0c2cd6 100644 --- a/indra/llxuixml/llinitparam.h +++ b/indra/llxuixml/llinitparam.h @@ -3,31 +3,25 @@ f * @file llinitparam.h * @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. + * + * 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. * - * 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 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. * - * 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. + * 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 * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -477,10 +471,10 @@ namespace LLInitParam bool deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack); bool serializeBlock(Parser& p, Parser::name_stack_t name_stack = Parser::name_stack_t(), const BaseBlock* diff_block = NULL) const; - virtual bool inspectBlock(Parser& p, Parser::name_stack_t name_stack = Parser::name_stack_t()) const; + bool inspectBlock(Parser& p, Parser::name_stack_t name_stack = Parser::name_stack_t()) const; - const BlockDescriptor& getBlockDescriptor() const { return *mBlockDescriptor; } - BlockDescriptor& getBlockDescriptor() { return *mBlockDescriptor; } + const BlockDescriptor& mostDerivedBlockDescriptor() const { return *mBlockDescriptor; } + BlockDescriptor& mostDerivedBlockDescriptor() { return *mBlockDescriptor; } // take all provided params from other and apply to self bool overwriteFrom(const BaseBlock& other) @@ -507,7 +501,7 @@ namespace LLInitParam BlockDescriptor* mBlockDescriptor; // most derived block descriptor - static BlockDescriptor& blockDescriptor() + static BlockDescriptor& selfBlockDescriptor() { static BlockDescriptor sBlockDescriptor; return sBlockDescriptor; @@ -559,7 +553,7 @@ namespace LLInitParam TypedParam(BlockDescriptor& block_descriptor, const char* name, value_assignment_t value, ParamDescriptor::validation_func_t validate_func, S32 min_count, S32 max_count) : Param(block_descriptor.mCurrentBlockPtr) { - if (block_descriptor.mInitializationState == BlockDescriptor::INITIALIZING) + if (LL_UNLIKELY(block_descriptor.mInitializationState == BlockDescriptor::INITIALIZING)) { ParamDescriptor param_descriptor(block_descriptor.mCurrentBlockPtr->getHandleFromParam(this), &mergeWith, @@ -584,6 +578,7 @@ namespace LLInitParam { if (parser.readValue<T>(typed_param.mData.mValue)) { + typed_param.mData.clearKey(); typed_param.setProvided(true); typed_param.enclosingBlock().setLastChangedParam(param, true); return true; @@ -690,7 +685,7 @@ namespace LLInitParam && (overwrite || !dst_typed_param.isProvided())) { dst_typed_param.mData.clearKey(); - dst_typed_param = src_typed_param; + dst_typed_param.set(src_typed_param.get()); return true; } return false; @@ -722,7 +717,7 @@ namespace LLInitParam : Param(block_descriptor.mCurrentBlockPtr), T(value) { - if (block_descriptor.mInitializationState == BlockDescriptor::INITIALIZING) + if (LL_UNLIKELY(block_descriptor.mInitializationState == BlockDescriptor::INITIALIZING)) { ParamDescriptor param_descriptor(block_descriptor.mCurrentBlockPtr->getHandleFromParam(this), &mergeWith, @@ -741,6 +736,7 @@ namespace LLInitParam // attempt to parse block... if(typed_param.deserializeBlock(parser, name_stack)) { + typed_param.mData.clearKey(); typed_param.enclosingBlock().setLastChangedParam(param, true); return true; } @@ -856,21 +852,10 @@ namespace LLInitParam { const self_t& src_typed_param = static_cast<const self_t&>(src); self_t& dst_typed_param = static_cast<self_t&>(dst); - if (overwrite) + if (dst_typed_param.T::merge(T::selfBlockDescriptor(), src_typed_param, overwrite || !dst_typed_param.isProvided())) { - if (dst_typed_param.T::overwriteFrom(src_typed_param)) - { - dst_typed_param.mData.clearKey(); - return true; - } - } - else - { - if (dst_typed_param.T::fillFrom(src_typed_param)) - { - dst_typed_param.mData.clearKey(); - return true; - } + dst_typed_param.mData.clearKey(); + return true; } return false; } @@ -911,7 +896,7 @@ namespace LLInitParam mValues(value) { mCachedKeys.resize(mValues.size()); - if (block_descriptor.mInitializationState == BlockDescriptor::INITIALIZING) + if (LL_UNLIKELY(block_descriptor.mInitializationState == BlockDescriptor::INITIALIZING)) { ParamDescriptor param_descriptor(block_descriptor.mCurrentBlockPtr->getHandleFromParam(this), &mergeWith, @@ -1060,9 +1045,9 @@ namespace LLInitParam self_t& dst_typed_param = static_cast<self_t&>(dst); if (src_typed_param.isProvided() - && (overwrite || !isProvided())) + && (overwrite || !dst_typed_param.isProvided())) { - dst_typed_param = src_typed_param; + dst_typed_param.set(src_typed_param.get()); return true; } return false; @@ -1094,7 +1079,7 @@ namespace LLInitParam mLastParamGeneration(0) { mCachedKeys.resize(mValues.size()); - if (block_descriptor.mInitializationState == BlockDescriptor::INITIALIZING) + if (LL_UNLIKELY(block_descriptor.mInitializationState == BlockDescriptor::INITIALIZING)) { ParamDescriptor param_descriptor(block_descriptor.mCurrentBlockPtr->getHandleFromParam(this), &mergeWith, @@ -1252,7 +1237,7 @@ namespace LLInitParam if (src_typed_param.isProvided() && (overwrite || !dst_typed_param.isProvided())) { - dst_typed_param = src_typed_param; + dst_typed_param.set(src_typed_param.get()); return true; } return false; @@ -1282,13 +1267,24 @@ namespace LLInitParam // take all provided params from other and apply to self bool overwriteFrom(const self_t& other) { - mCurChoice = other.mCurChoice; - return BaseBlock::merge(blockDescriptor(), other, true); + return merge(selfBlockDescriptor(), other, true); } // take all provided params that are not already provided, and apply to self bool fillFrom(const self_t& other) { + return merge(selfBlockDescriptor(), other, false); + } + + // merge with other block + bool merge(BlockDescriptor& block_data, const self_t& other, bool overwrite) + { + // only merge a choice if we are overwriting with other's contents + if (overwrite) + { + mCurChoice = other.mCurChoice; + return BaseBlock::merge(selfBlockDescriptor(), other, overwrite); + } return false; } @@ -1314,7 +1310,7 @@ namespace LLInitParam Choice() : mCurChoice(0) { - BaseBlock::init(blockDescriptor(), BaseBlock::blockDescriptor(), sizeof(DERIVED_BLOCK)); + BaseBlock::init(selfBlockDescriptor(), BaseBlock::selfBlockDescriptor(), sizeof(DERIVED_BLOCK)); } // Alternatives are mutually exclusive wrt other Alternatives in the same block. @@ -1331,13 +1327,14 @@ namespace LLInitParam typedef typename super_t::value_assignment_t value_assignment_t; explicit Alternative(const char* name, value_assignment_t val = DefaultInitializer<T>::get()) - : super_t(DERIVED_BLOCK::blockDescriptor(), name, val, NULL, 0, 1), + : super_t(DERIVED_BLOCK::selfBlockDescriptor(), name, val, NULL, 0, 1), mOriginalValue(val) { // assign initial choice to first declared option - DERIVED_BLOCK* blockp = ((DERIVED_BLOCK*)DERIVED_BLOCK::blockDescriptor().mCurrentBlockPtr); - if (DERIVED_BLOCK::blockDescriptor().mInitializationState == BlockDescriptor::INITIALIZING - && blockp->mCurChoice == 0) + DERIVED_BLOCK* blockp = ((DERIVED_BLOCK*)DERIVED_BLOCK::selfBlockDescriptor().mCurrentBlockPtr); + if (LL_UNLIKELY( + DERIVED_BLOCK::selfBlockDescriptor().mInitializationState == BlockDescriptor::INITIALIZING + && blockp->mCurChoice == 0)) { blockp->mCurChoice = Param::enclosingBlock().getHandleFromParam(this); } @@ -1382,7 +1379,7 @@ namespace LLInitParam }; protected: - static BlockDescriptor& blockDescriptor() + static BlockDescriptor& selfBlockDescriptor() { static BlockDescriptor sBlockDescriptor; return sBlockDescriptor; @@ -1410,19 +1407,19 @@ namespace LLInitParam // take all provided params from other and apply to self bool overwriteFrom(const self_t& other) { - return BaseBlock::merge(blockDescriptor(), other, true); + return BaseBlock::merge(selfBlockDescriptor(), other, true); } // take all provided params that are not already provided, and apply to self bool fillFrom(const self_t& other) { - return BaseBlock::merge(blockDescriptor(), other, false); + return BaseBlock::merge(selfBlockDescriptor(), other, false); } protected: Block() { //#pragma message("Parsing LLInitParam::Block") - BaseBlock::init(blockDescriptor(), BASE_BLOCK::blockDescriptor(), sizeof(DERIVED_BLOCK)); + BaseBlock::init(selfBlockDescriptor(), BASE_BLOCK::selfBlockDescriptor(), sizeof(DERIVED_BLOCK)); } // @@ -1436,7 +1433,7 @@ namespace LLInitParam typedef typename super_t::value_assignment_t value_assignment_t; explicit Optional(const char* name = "", value_assignment_t val = DefaultInitializer<T>::get()) - : super_t(DERIVED_BLOCK::blockDescriptor(), name, val, NULL, 0, 1) + : super_t(DERIVED_BLOCK::selfBlockDescriptor(), name, val, NULL, 0, 1) { //#pragma message("Parsing LLInitParam::Block::Optional") } @@ -1465,7 +1462,7 @@ namespace LLInitParam // mandatory parameters require a name to be parseable explicit Mandatory(const char* name = "", value_assignment_t val = DefaultInitializer<T>::get()) - : super_t(DERIVED_BLOCK::blockDescriptor(), name, val, &validate, 1, 1) + : super_t(DERIVED_BLOCK::selfBlockDescriptor(), name, val, &validate, 1, 1) {} Mandatory& operator=(value_assignment_t val) @@ -1501,7 +1498,7 @@ namespace LLInitParam typedef typename container_t::const_iterator const_iterator; explicit Multiple(const char* name = "", value_assignment_t val = DefaultInitializer<container_t>::get()) - : super_t(DERIVED_BLOCK::blockDescriptor(), name, val, &validate, RANGE::minCount(), RANGE::maxCount()) + : super_t(DERIVED_BLOCK::selfBlockDescriptor(), name, val, &validate, RANGE::minCount(), RANGE::maxCount()) {} using super_t::operator(); @@ -1529,10 +1526,10 @@ namespace LLInitParam { public: explicit Deprecated(const char* name) - : Param(DERIVED_BLOCK::blockDescriptor().mCurrentBlockPtr) + : Param(DERIVED_BLOCK::selfBlockDescriptor().mCurrentBlockPtr) { - BlockDescriptor& block_descriptor = DERIVED_BLOCK::blockDescriptor(); - if (block_descriptor.mInitializationState == BlockDescriptor::INITIALIZING) + BlockDescriptor& block_descriptor = DERIVED_BLOCK::selfBlockDescriptor(); + if (LL_UNLIKELY(block_descriptor.mInitializationState == BlockDescriptor::INITIALIZING)) { ParamDescriptor param_descriptor(block_descriptor.mCurrentBlockPtr->getHandleFromParam(this), NULL, @@ -1561,7 +1558,7 @@ namespace LLInitParam typedef Deprecated Ignored; protected: - static BlockDescriptor& blockDescriptor() + static BlockDescriptor& selfBlockDescriptor() { static BlockDescriptor sBlockDescriptor; return sBlockDescriptor; @@ -1574,6 +1571,13 @@ namespace LLInitParam public Param { public: + typedef enum e_value_age + { + OLDER_THAN_BLOCK, // mData.mValue needs to be refreshed from the block parameters + NEWER_THAN_BLOCK, // mData.mValue holds the authoritative value (which has been replicated to the block parameters via setBlockFromValue) + SAME_AS_BLOCK // mData.mValue is derived from the block parameters, which are authoritative + } EValueAge; + typedef BlockValue<T> self_t; typedef Block<TypedParam<T, TypeValues<T>, false> > block_t; typedef const T& value_const_ref_t; @@ -1582,9 +1586,9 @@ namespace LLInitParam BlockValue(BlockDescriptor& block_descriptor, const char* name, value_assignment_t value, ParamDescriptor::validation_func_t validate_func, S32 min_count, S32 max_count) : Param(block_descriptor.mCurrentBlockPtr), - mData(value) + mData(value, NEWER_THAN_BLOCK) { - if (block_descriptor.mInitializationState == BlockDescriptor::INITIALIZING) + if (LL_UNLIKELY(block_descriptor.mInitializationState == BlockDescriptor::INITIALIZING)) { ParamDescriptor param_descriptor(block_descriptor.mCurrentBlockPtr->getHandleFromParam(this), &mergeWith, @@ -1604,7 +1608,7 @@ namespace LLInitParam static bool deserializeParam(Param& param, Parser& parser, const Parser::name_stack_range_t& name_stack, S32 generation) { - self_t& typed_param = static_cast<self_t&>(param); + DERIVED& typed_param = static_cast<DERIVED&>(param); // type to apply parse direct value T if (name_stack.first == name_stack.second) { @@ -1612,7 +1616,10 @@ namespace LLInitParam { typed_param.enclosingBlock().setLastChangedParam(param, true); typed_param.setProvided(true); - typed_param.mData.mLastParamVersion = typed_param.BaseBlock::getLastChangeVersion(); + typed_param.mData.clearKey(); + typed_param.mData.mValueAge = NEWER_THAN_BLOCK; + typed_param.setBlockFromValue(); + return true; } @@ -1628,7 +1635,9 @@ namespace LLInitParam typed_param.mData.setKey(name); typed_param.enclosingBlock().setLastChangedParam(param, true); typed_param.setProvided(true); - typed_param.mData.mLastParamVersion = typed_param.BaseBlock::getLastChangeVersion(); + typed_param.mData.mValueAge = NEWER_THAN_BLOCK; + typed_param.setBlockFromValue(); + return true; } } @@ -1703,16 +1712,18 @@ namespace LLInitParam bool isProvided() const { - // either param value provided directly or block is sufficiently filled in + if (!Param::getProvided()) return false; + + // block has an updated parameter // if cached value is stale, regenerate from params - if (Param::getProvided() && mData.mLastParamVersion < BaseBlock::getLastChangeVersion()) + if (mData.mValueAge == OLDER_THAN_BLOCK) { if (block_t::validateBlock(false)) { static_cast<const DERIVED*>(this)->setValueFromBlock(); // clear stale keyword associated with old value mData.clearKey(); - mData.mLastParamVersion = BaseBlock::getLastChangeVersion(); + mData.mValueAge = SAME_AS_BLOCK; return true; } else @@ -1722,8 +1733,11 @@ namespace LLInitParam return false; } } - // either no data provided, or we have a valid value in hand - return Param::getProvided(); + else + { + // we have a valid value in hand + return true; + } } void set(value_assignment_t val, bool flag_as_provided = true) @@ -1731,7 +1745,7 @@ namespace LLInitParam Param::enclosingBlock().setLastChangedParam(*this, flag_as_provided); // set param version number to be up to date, so we ignore block contents - mData.mLastParamVersion = BaseBlock::getLastChangeVersion(); + mData.mValueAge = NEWER_THAN_BLOCK; mData.mValue = val; mData.clearKey(); @@ -1756,6 +1770,8 @@ namespace LLInitParam if (user_provided) { setProvided(true); // some component provided + // a parameter changed, so our value is out of date + mData.mValueAge = OLDER_THAN_BLOCK; } } @@ -1763,54 +1779,54 @@ namespace LLInitParam value_assignment_t get() const { // if some parameters were provided, issue warnings on invalid blocks - if (Param::getProvided() && (mData.mLastParamVersion < BaseBlock::getLastChangeVersion())) + if (Param::getProvided() && (mData.mValueAge == OLDER_THAN_BLOCK)) { // go ahead and issue warnings at this point if any param is invalid if(block_t::validateBlock(true)) { static_cast<const DERIVED*>(this)->setValueFromBlock(); mData.clearKey(); - mData.mLastParamVersion = BaseBlock::getLastChangeVersion(); + mData.mValueAge = SAME_AS_BLOCK; } } return mData.mValue; } - // mutable to allow lazy updates on get + struct Data : public key_cache_t { - Data(const T& value) + Data(const T& value, EValueAge age) : mValue(value), - mLastParamVersion(0) + mValueAge(age) {} - T mValue; - S32 mLastParamVersion; + T mValue; + EValueAge mValueAge; }; + // mutable to allow lazy updates on get mutable Data mData; private: static bool mergeWith(Param& dst, const Param& src, bool overwrite) { - const self_t& src_typed_param = static_cast<const self_t&>(src); - self_t& dst_typed_param = static_cast<self_t&>(dst); + const DERIVED& src_typed_param = static_cast<const DERIVED&>(src); + DERIVED& dst_typed_param = static_cast<DERIVED&>(dst); if (src_typed_param.isProvided() && (overwrite || !dst_typed_param.isProvided())) { - // assign individual parameters - dst_typed_param.BaseBlock::merge(block_t::blockDescriptor(), src_typed_param, overwrite); - - // then copy actual value - dst_typed_param.mData.mValue = src_typed_param.get(); - dst_typed_param.mData.clearKey(); - dst_typed_param.setProvided(true); - - // Propagate value back to block params since the value was updated during this merge. - // This will result in mData.mValue and the block params being in sync. - static_cast<DERIVED&>(dst_typed_param).setBlockFromValue(); + if (src_typed_param.mData.mValueAge == NEWER_THAN_BLOCK) + { + // copy value over + dst_typed_param.set(src_typed_param.get()); + } + else + { + // merge individual parameters into destination + dst_typed_param.merge(block_t::selfBlockDescriptor(), src_typed_param, overwrite); + } return true; } return false; diff --git a/indra/llxuixml/llregistry.h b/indra/llxuixml/llregistry.h index 2c04d8c419..ee119b9ebc 100644 --- a/indra/llxuixml/llregistry.h +++ b/indra/llxuixml/llregistry.h @@ -2,31 +2,25 @@ * @file llregistry.h * @brief template classes for registering name, value pairs in nested scopes, statically, etc. * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2001&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. + * + * 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. * - * 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 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. * - * 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. + * 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 * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llxuixml/lltrans.cpp b/indra/llxuixml/lltrans.cpp index d6f17dbb08..01e13864b6 100644 --- a/indra/llxuixml/lltrans.cpp +++ b/indra/llxuixml/lltrans.cpp @@ -2,31 +2,25 @@ * @file lltrans.cpp * @brief LLTrans implementation * - * $LicenseInfo:firstyear=2000&license=viewergpl$ - * - * Copyright (c) 2000-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2000&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. + * + * 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. * - * 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 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. * - * 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. + * 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 * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llxuixml/lltrans.h b/indra/llxuixml/lltrans.h index 856b9e04fc..5c90695598 100644 --- a/indra/llxuixml/lltrans.h +++ b/indra/llxuixml/lltrans.h @@ -2,31 +2,25 @@ * @file lltrans.h * @brief LLTrans definition * - * $LicenseInfo:firstyear=2000&license=viewergpl$ - * - * Copyright (c) 2000-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2000&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. + * + * 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. * - * 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 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. * - * 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. + * 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 * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llxuixml/lluicolor.cpp b/indra/llxuixml/lluicolor.cpp index 0049ec055c..f9bb80f8c5 100644 --- a/indra/llxuixml/lluicolor.cpp +++ b/indra/llxuixml/lluicolor.cpp @@ -2,8 +2,25 @@ * @file lluicolor.cpp * @brief brief LLUIColor class implementation file * - * $LicenseInfo:firstyear=2009&license=viewergpl$ - * Copyright (c) 2009, Linden Research, Inc. + * $LicenseInfo:firstyear=2009&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * 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. + * + * 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. + * + * 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$ */ diff --git a/indra/llxuixml/lluicolor.h b/indra/llxuixml/lluicolor.h index 0ef2f78b24..97ebea854a 100644 --- a/indra/llxuixml/lluicolor.h +++ b/indra/llxuixml/lluicolor.h @@ -2,8 +2,25 @@ * @file lluicolor.h * @brief brief LLUIColor class header file * - * $LicenseInfo:firstyear=2009&license=viewergpl$ - * Copyright (c) 2009, Linden Research, Inc. + * $LicenseInfo:firstyear=2009&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * 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. + * + * 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. + * + * 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$ */ diff --git a/indra/llxuixml/llxuiparser.cpp b/indra/llxuixml/llxuiparser.cpp index dbc20a5a1e..8469debd3e 100644 --- a/indra/llxuixml/llxuiparser.cpp +++ b/indra/llxuixml/llxuiparser.cpp @@ -2,31 +2,25 @@ * @file llxuiparser.cpp * @brief Utility functions for handling XUI structures in XML * - * $LicenseInfo:firstyear=2003&license=viewergpl$ - * - * Copyright (c) 2003-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2003&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. + * + * 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. * - * 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 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. * - * 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. + * 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 * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llxuixml/llxuiparser.h b/indra/llxuixml/llxuiparser.h index 884f4f7578..30b7e8c356 100644 --- a/indra/llxuixml/llxuiparser.h +++ b/indra/llxuixml/llxuiparser.h @@ -2,31 +2,25 @@ * @file llxuiparser.h * @brief Utility functions for handling XUI structures in XML * - * $LicenseInfo:firstyear=2003&license=viewergpl$ - * - * Copyright (c) 2003-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2003&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. + * + * 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. * - * 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 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. * - * 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. + * 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 * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ |