Merge branch 'UICleanup' of git://github.com/Shyotl/SingularityViewer
Conflicts: indra/llappearance/llwearable.h indra/llui/llcombobox.h indra/newview/jcfloaterareasearch.cpp indra/newview/jcfloaterareasearch.h indra/newview/llpanelgrouproles.cpp indra/newview/llpanelgrouproles.h indra/newview/llviewermenu.cpp - Plugged in new MenuFloaterDict for AssetBlacklist and SoundExplorer in menu_viewer.xml and removed the old listeners for them. indra/newview/skins/default/xui/es/floater_inventory.xml Compile Fixes: indra/llcommon/llstl.h - error: expected nested-name-specifier before ‘const’ indra/llui/llmultisliderctrl.cpp:283:12: error: ‘caller’ was not declared in this scope indra/llui/lltexteditor.cpp - error: operands to ?: have different types ‘const LLPointer<LLTextSegment>’ and ‘long int’ - error: passing ‘const LLPointer<LLTextSegment>’ as ‘this’ argument of ‘LLPointer<Type>& LLPointer<Type>::operator=(const LLPointer<Type>&) [with Type = LLTextSegment]’ discards qualifiers indra/newview/llfloaterpermissionsmgr.cpp - Silly Shyotl, boost bind, not std bind. indra/newview/llfloaterproperties.* - error: ‘LLInstanceTracker<LLFloaterProperties, LLUUID>’ is an inaccessible base of ‘LLFloaterProperties’ indra/newview/llgivemoney.cpp - Again, boost::ref, not std::ref indra/newview/llpreviewscript.cpp - no known conversion for argument 1 from ‘std::vector<const LLPointer<LLTextSegment> >’ to ‘std::vector<LLPointer<LLTextSegment> >&
This commit is contained in:
@@ -54,7 +54,10 @@ protected:
|
||||
template<typename STATICDATA, class TRACKED>
|
||||
static STATICDATA& getStatic()
|
||||
{
|
||||
void *& instances = getInstances(typeid(TRACKED));
|
||||
//Singu note: Don't de-static the instances variable. getInstances is incredibly
|
||||
//expensive. Calling getInstances once and caching the result is sufficient
|
||||
//to avoid the instance-per-module issue noted above.
|
||||
static void *& instances = getInstances(typeid(TRACKED));
|
||||
if (! instances)
|
||||
{
|
||||
instances = new STATICDATA;
|
||||
|
||||
@@ -109,6 +109,16 @@ public:
|
||||
return const_cast<self*>(this)->find(key);
|
||||
}
|
||||
|
||||
//For easy insertion shorthand. Eases std::map => LLSortedVector drop-in replacement.
|
||||
mapped_type& operator[] (const key_type& key)
|
||||
{
|
||||
return insert(std::make_pair(key,mapped_type())).first->second;
|
||||
}
|
||||
const mapped_type& operator[] (const key_type& key) const
|
||||
{
|
||||
return insert(std::make_pair(key,mapped_type())).first->second;
|
||||
}
|
||||
|
||||
private:
|
||||
// Define our own 'less' comparator so we can specialize without messing
|
||||
// with std::less.
|
||||
|
||||
@@ -175,33 +175,10 @@ struct CopyNewPointer
|
||||
}
|
||||
};
|
||||
|
||||
// Simple function to help with finding pointers in maps.
|
||||
// For example:
|
||||
// typedef map_t;
|
||||
// std::map<int, const char*> foo;
|
||||
// foo[18] = "there";
|
||||
// foo[2] = "hello";
|
||||
// const char* bar = get_ptr_in_map(foo, 2); // bar -> "hello"
|
||||
// const char* baz = get_ptr_in_map(foo, 3); // baz == NULL
|
||||
template <typename K, typename T>
|
||||
inline T* get_ptr_in_map(const std::map<K,T*>& inmap, const K& key)
|
||||
{
|
||||
// Typedef here avoids warnings because of new c++ naming rules.
|
||||
typedef typename std::map<K,T*>::const_iterator map_iter;
|
||||
map_iter iter = inmap.find(key);
|
||||
if(iter == inmap.end())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
return iter->second;
|
||||
}
|
||||
};
|
||||
|
||||
// helper function which returns true if key is in inmap.
|
||||
template <typename K, typename T>
|
||||
inline bool is_in_map(const std::map<K,T>& inmap, const K& key)
|
||||
template <typename T>
|
||||
//Singu note: This has been generalized to support a broader range of map-esque containers
|
||||
inline bool is_in_map(const T& inmap, typename T::key_type const& key)
|
||||
{
|
||||
if(inmap.find(key) == inmap.end())
|
||||
{
|
||||
@@ -217,11 +194,13 @@ inline bool is_in_map(const std::map<K,T>& inmap, const K& key)
|
||||
// To replace LLSkipMap getIfThere, use:
|
||||
// get_if_there(map, key, 0)
|
||||
// WARNING: Make sure default_value (generally 0) is not a valid map entry!
|
||||
template <typename K, typename T>
|
||||
inline T get_if_there(const std::map<K,T>& inmap, const K& key, T default_value)
|
||||
//
|
||||
//Singu note: This has been generalized to support a broader range of map-esque containers.
|
||||
template <typename T>
|
||||
inline typename T::mapped_type get_if_there(const T& inmap, typename T::key_type const& key, typename T::mapped_type default_value)
|
||||
{
|
||||
// Typedef here avoids warnings because of new c++ naming rules.
|
||||
typedef typename std::map<K,T>::const_iterator map_iter;
|
||||
typedef typename T::const_iterator map_iter;
|
||||
map_iter iter = inmap.find(key);
|
||||
if(iter == inmap.end())
|
||||
{
|
||||
@@ -233,6 +212,21 @@ inline T get_if_there(const std::map<K,T>& inmap, const K& key, T default_value)
|
||||
}
|
||||
};
|
||||
|
||||
// Simple function to help with finding pointers in maps.
|
||||
// For example:
|
||||
// typedef map_t;
|
||||
// std::map<int, const char*> foo;
|
||||
// foo[18] = "there";
|
||||
// foo[2] = "hello";
|
||||
// const char* bar = get_ptr_in_map(foo, 2); // bar -> "hello"
|
||||
// const char* baz = get_ptr_in_map(foo, 3); // baz == NULL
|
||||
//Singu note: This has been generalized to support a broader range of map-esque containers
|
||||
template <typename T>
|
||||
inline typename T::mapped_type get_ptr_in_map(const T& inmap, typename T::key_type const& key)
|
||||
{
|
||||
return get_if_there(inmap,key,NULL);
|
||||
};
|
||||
|
||||
// Useful for replacing the removeObj() functionality of LLDynamicArray
|
||||
// Example:
|
||||
// for (std::vector<T>::iterator iter = mList.begin(); iter != mList.end(); )
|
||||
@@ -242,10 +236,12 @@ inline T get_if_there(const std::map<K,T>& inmap, const K& key, T default_value)
|
||||
// else
|
||||
// ++iter;
|
||||
// }
|
||||
template <typename T, typename Iter>
|
||||
inline Iter vector_replace_with_last(std::vector<T>& invec, Iter iter)
|
||||
//
|
||||
//Singu note: This has been generalized to support a broader range of sequence containers
|
||||
template <typename T>
|
||||
inline typename T::iterator vector_replace_with_last(T& invec, typename T::iterator& iter)
|
||||
{
|
||||
typename std::vector<T>::iterator last = invec.end(); --last;
|
||||
typename T::iterator last = invec.end(); --last;
|
||||
if (iter == invec.end())
|
||||
{
|
||||
return iter;
|
||||
@@ -266,13 +262,15 @@ inline Iter vector_replace_with_last(std::vector<T>& invec, Iter iter)
|
||||
// Useful for replacing the removeObj() functionality of LLDynamicArray
|
||||
// Example:
|
||||
// vector_replace_with_last(mList, x);
|
||||
//
|
||||
//Singu note: This has been generalized to support a broader range of sequence containers
|
||||
template <typename T>
|
||||
inline bool vector_replace_with_last(std::vector<T>& invec, const T& val)
|
||||
inline bool vector_replace_with_last(T& invec, typename T::value_type const& val)
|
||||
{
|
||||
typename std::vector<T>::iterator iter = std::find(invec.begin(), invec.end(), val);
|
||||
typename T::iterator iter = std::find(invec.begin(), invec.end(), val);
|
||||
if (iter != invec.end())
|
||||
{
|
||||
typename std::vector<T>::iterator last = invec.end(); --last;
|
||||
typename T::iterator last = invec.end(); --last;
|
||||
*iter = *last;
|
||||
invec.pop_back();
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user