Allow some of the Array and Dictionary methods to be inlined by the compiler

fixes #8666
This commit is contained in:
Gunnar Beutner 2015-03-10 13:45:29 +01:00
parent 54b5cd33e5
commit 37aa3413d8
4 changed files with 66 additions and 72 deletions

View File

@ -69,34 +69,6 @@ void Array::Add(const Value& value)
m_Data.push_back(value);
}
/**
* Returns an iterator to the beginning of the array.
*
* Note: Caller must hold the object lock while using the iterator.
*
* @returns An iterator.
*/
Array::Iterator Array::Begin(void)
{
ASSERT(OwnsLock());
return m_Data.begin();
}
/**
* Returns an iterator to the end of the array.
*
* Note: Caller must hold the object lock while using the iterator.
*
* @returns An iterator.
*/
Array::Iterator Array::End(void)
{
ASSERT(OwnsLock());
return m_Data.end();
}
/**
* Returns the number of elements in the array.
*

View File

@ -49,8 +49,33 @@ public:
void Set(unsigned int index, const Value& value);
void Add(const Value& value);
Iterator Begin(void);
Iterator End(void);
/**
* Returns an iterator to the beginning of the array.
*
* Note: Caller must hold the object lock while using the iterator.
*
* @returns An iterator.
*/
inline Iterator Begin(void)
{
ASSERT(OwnsLock());
return m_Data.begin();
}
/**
* Returns an iterator to the end of the array.
*
* Note: Caller must hold the object lock while using the iterator.
*
* @returns An iterator.
*/
inline Iterator End(void)
{
ASSERT(OwnsLock());
return m_Data.end();
}
size_t GetLength(void) const;
bool Contains(const Value& value) const;

View File

@ -108,33 +108,6 @@ void Dictionary::Set(const String& key, const Value& value)
ret.first->second = value;
}
/**
* Returns an iterator to the beginning of the dictionary.
*
* Note: Caller must hold the object lock while using the iterator.
*
* @returns An iterator.
*/
Dictionary::Iterator Dictionary::Begin(void)
{
ASSERT(OwnsLock());
return m_Data.begin();
}
/**
* Returns an iterator to the end of the dictionary.
*
* Note: Caller must hold the object lock while using the iterator.
*
* @returns An iterator.
*/
Dictionary::Iterator Dictionary::End(void)
{
ASSERT(OwnsLock());
return m_Data.end();
}
/**
* Returns the number of elements in the dictionary.
@ -182,18 +155,6 @@ void Dictionary::Remove(const String& key)
m_Data.erase(it);
}
/**
* Removes the item specified by the iterator from the dictionary.
*
* @param it The iterator.
*/
void Dictionary::Remove(Dictionary::Iterator it)
{
ASSERT(OwnsLock());
m_Data.erase(it);
}
/**
* Removes all dictionary items.
*/

View File

@ -54,13 +54,49 @@ public:
void Set(const String& key, const Value& value);
bool Contains(const String& key) const;
Iterator Begin(void);
Iterator End(void);
/**
* Returns an iterator to the beginning of the dictionary.
*
* Note: Caller must hold the object lock while using the iterator.
*
* @returns An iterator.
*/
inline Iterator Begin(void)
{
ASSERT(OwnsLock());
return m_Data.begin();
}
/**
* Returns an iterator to the end of the dictionary.
*
* Note: Caller must hold the object lock while using the iterator.
*
* @returns An iterator.
*/
inline Iterator End(void)
{
ASSERT(OwnsLock());
return m_Data.end();
}
size_t GetLength(void) const;
void Remove(const String& key);
void Remove(Iterator it);
/**
* Removes the item specified by the iterator from the dictionary.
*
* @param it The iterator.
*/
inline void Remove(Iterator it)
{
ASSERT(OwnsLock());
m_Data.erase(it);
}
void Clear(void);