summaryrefslogtreecommitdiff
path: root/indra/llxuixml
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llxuixml')
-rw-r--r--indra/llxuixml/llinitparam.h88
-rw-r--r--indra/llxuixml/llregistry.h4
2 files changed, 48 insertions, 44 deletions
diff --git a/indra/llxuixml/llinitparam.h b/indra/llxuixml/llinitparam.h
index ce59401e87..d44ccac6e4 100644
--- a/indra/llxuixml/llinitparam.h
+++ b/indra/llxuixml/llinitparam.h
@@ -212,7 +212,7 @@ namespace LLInitParam
{}
ParamValue(const default_value_t& other)
- : T(other),
+ : T(other),
mValidated(false)
{}
@@ -632,38 +632,38 @@ namespace LLInitParam
class BaseBlock* mCurrentBlockPtr; // pointer to block currently being constructed
};
- //TODO: implement in terms of owned_ptr
- template<typename T>
+ //TODO: implement in terms of owned_ptr
+ template<typename T>
class LazyValue
- {
+ {
public:
LazyValue()
- : mPtr(NULL)
- {}
+ : mPtr(NULL)
+ {}
~LazyValue()
- {
- delete mPtr;
- }
+ {
+ delete mPtr;
+ }
LazyValue(const T& value)
- {
+ {
mPtr = new T(value);
}
LazyValue(const LazyValue& other)
: mPtr(NULL)
- {
+ {
*this = other;
- }
+ }
LazyValue& operator = (const LazyValue& other)
{
if (!other.mPtr)
- {
+ {
delete mPtr;
- mPtr = NULL;
- }
+ mPtr = NULL;
+ }
else
{
if (!mPtr)
@@ -674,9 +674,9 @@ namespace LLInitParam
{
*mPtr = *(other.mPtr);
}
- }
- return *this;
}
+ return *this;
+ }
bool operator==(const LazyValue& other) const
{
@@ -684,13 +684,13 @@ namespace LLInitParam
return *mPtr == *other.mPtr;
}
- bool empty() const
- {
- return mPtr == NULL;
- }
+ bool empty() const
+ {
+ return mPtr == NULL;
+ }
- void set(const T& other)
- {
+ void set(const T& other)
+ {
if (!mPtr)
{
mPtr = new T(other);
@@ -701,36 +701,36 @@ namespace LLInitParam
}
}
- const T& get() const
- {
+ const T& get() const
+ {
return *ensureInstance();
- }
+ }
- T& get()
- {
+ T& get()
+ {
return *ensureInstance();
}
operator const T&() const
{
return get();
- }
+ }
- private:
- // lazily allocate an instance of T
- T* ensureInstance() const
+ private:
+ // lazily allocate an instance of T
+ T* ensureInstance() const
+ {
+ if (mPtr == NULL)
{
- if (mPtr == NULL)
- {
- mPtr = new T();
- }
- return mPtr;
- }
+ mPtr = new T();
+ }
+ return mPtr;
+ }
- private:
+ private:
- mutable T* mPtr;
- };
+ mutable T* mPtr;
+ };
// root class of all parameter blocks
@@ -2492,10 +2492,10 @@ namespace LLInitParam
} EValueAge;
typedef ParamValue<T> derived_t;
- typedef CustomParamValue<T> self_t;
- typedef Block<derived_t> block_t;
+ typedef CustomParamValue<T> self_t;
+ typedef Block<derived_t> block_t;
typedef T default_value_t;
- typedef T value_t;
+ typedef T value_t;
typedef void baseblock_base_class_t;
diff --git a/indra/llxuixml/llregistry.h b/indra/llxuixml/llregistry.h
index 36ce6a97b7..3e8d9267cc 100644
--- a/indra/llxuixml/llregistry.h
+++ b/indra/llxuixml/llregistry.h
@@ -302,6 +302,10 @@ public:
virtual ~StaticRegistrar() {}
StaticRegistrar(ref_const_key_t key, ref_const_value_t value)
{
+ if (singleton_t::instance().exists(key))
+ {
+ llerrs << "Duplicate registry entry under key \"" << key << "\"" << llendl;
+ }
singleton_t::instance().mStaticScope->add(key, value);
}
};