From 5edb4f2171fb92ff64913459a63afb20474db25a Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Thu, 15 Oct 2009 19:56:45 +0000 Subject: removed requirement for specializing ParamCompare on boost::function types eliminated usage of iterator_range from LLInitParam made LLTextEditor::addChar consistent with truncate in counting text bytes (not including null terminator) EXT-1494 - Avatar profile description text truncated to 255 characters reviewed by Leyla --- indra/llxuixml/llinitparam.h | 61 ++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 34 deletions(-) (limited to 'indra/llxuixml/llinitparam.h') diff --git a/indra/llxuixml/llinitparam.h b/indra/llxuixml/llinitparam.h index 88bc430504..193d8c1f64 100644 --- a/indra/llxuixml/llinitparam.h +++ b/indra/llxuixml/llinitparam.h @@ -39,25 +39,31 @@ #include #include #include -#include +#include #include "llregistry.h" #include "llmemory.h" namespace LLInitParam { - template - class ParamCompare { - public: - static bool equals(const T &a, const T &b); + template ::type > + struct ParamCompare + { + static bool equals(const T &a, const T &b) + { + return a == b; + } }; - template - bool ParamCompare::equals(const T &a, const T&b) - { - return a == b; - } - + // boost function types are not comparable + template + struct ParamCompare + { + static bool equals(const T&a, const T &b) + { + return false; + } + }; // default constructor adaptor for InitParam Values // constructs default instances of the given type, returned by const reference @@ -192,7 +198,7 @@ namespace LLInitParam }; typedef std::vector > name_stack_t; - typedef boost::iterator_range name_stack_range_t; + typedef std::pair name_stack_range_t; typedef std::vector possible_values_t; typedef boost::function parser_read_func_t; @@ -535,7 +541,7 @@ namespace LLInitParam { self_t& typed_param = static_cast(param); // no further names in stack, attempt to parse value now - if (name_stack.empty()) + if (name_stack.first == name_stack.second) { if (parser.readValue(typed_param.mData.mValue)) { @@ -886,7 +892,7 @@ namespace LLInitParam self_t& typed_param = static_cast(param); value_t value; // no further names in stack, attempt to parse value now - if (name_stack.empty()) + if (name_stack.first == name_stack.second) { // attempt to read value directly if (parser.readValue(value)) @@ -1541,7 +1547,7 @@ namespace LLInitParam static bool deserializeParam(Param& param, Parser& parser, const Parser::name_stack_range_t& name_stack, S32 generation) { - if (name_stack.empty()) + if (name_stack.first == name_stack.second) { //std::string message = llformat("Deprecated value %s ignored", getName().c_str()); //parser.parserWarning(message); @@ -1600,7 +1606,7 @@ namespace LLInitParam { self_t& typed_param = static_cast(param); // type to apply parse direct value T - if (name_stack.empty()) + if (name_stack.first == name_stack.second) { if(parser.readValue(typed_param.mData.mValue)) { @@ -1811,24 +1817,11 @@ namespace LLInitParam } }; - template<> - bool ParamCompare >::equals( - const boost::function &a, - const boost::function &b); - - template<> - bool ParamCompare >::equals( - const boost::function &a, - const boost::function &b); - - template<> - bool ParamCompare >::equals( - const boost::function &a, - const boost::function &b); - - - template<> - bool ParamCompare::equals(const LLSD &a, const LLSD &b); + template<> + struct ParamCompare + { + static bool equals(const LLSD &a, const LLSD &b); + }; } #endif // LL_LLPARAM_H -- cgit v1.2.3 From 2ff7f8a772e07335e4ab6788410858667189059e Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Thu, 15 Oct 2009 21:35:30 +0000 Subject: fix for gcc build --- indra/llxuixml/llinitparam.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/llxuixml/llinitparam.h') diff --git a/indra/llxuixml/llinitparam.h b/indra/llxuixml/llinitparam.h index 193d8c1f64..b280dfdf63 100644 --- a/indra/llxuixml/llinitparam.h +++ b/indra/llxuixml/llinitparam.h @@ -46,7 +46,7 @@ namespace LLInitParam { - template ::type > + template ::value > struct ParamCompare { static bool equals(const T &a, const T &b) @@ -57,7 +57,7 @@ namespace LLInitParam // boost function types are not comparable template - struct ParamCompare + struct ParamCompare { static bool equals(const T&a, const T &b) { @@ -1818,7 +1818,7 @@ namespace LLInitParam }; template<> - struct ParamCompare + struct ParamCompare { static bool equals(const LLSD &a, const LLSD &b); }; -- cgit v1.2.3