merge changes from develop

This commit is contained in:
Guenter Obiltschnig
2016-04-21 09:36:53 +02:00
parent 50240732f9
commit 27f41ee785

View File

@@ -37,7 +37,7 @@ class ListMap
/// ordering of elements is not desirable. Naturally, this container will /// ordering of elements is not desirable. Naturally, this container will
/// have inferior data retrieval performance and it is not recommended for /// have inferior data retrieval performance and it is not recommended for
/// use with large datasets. The main purpose within POCO is for Internet /// use with large datasets. The main purpose within POCO is for Internet
/// messages (email message, http headers etc), to prevent autmomatic /// messages (email message, http headers etc), to prevent automatic
/// header entry reordering. /// header entry reordering.
{ {
public: public:
@@ -103,33 +103,33 @@ public:
} }
ConstIterator find(const KeyType& key) const ConstIterator find(const KeyType& key) const
/// Finds the first occurence of the key and /// Finds the first occurrence of the key and
/// returns iterator pointing to the found entry /// returns iterator pointing to the found entry
/// or iterator pointing to the end if entry is /// or iterator pointing to the end if entry is
/// not found. /// not found.
{ {
typename Container::const_iterator it = _list.begin(); typename Container::const_iterator it = _list.begin();
typename Container::const_iterator end = _list.end(); typename Container::const_iterator itEnd = _list.end();
for(; it != end; ++it) for(; it != itEnd; ++it)
{ {
if (isEqual(it->first, key)) return it; if (isEqual(it->first, key)) return it;
} }
return end; return itEnd;
} }
Iterator find(const KeyType& key) Iterator find(const KeyType& key)
/// Finds the first occurence of the key and /// Finds the first occurrence of the key and
/// returns iterator pointing to the found entry /// returns iterator pointing to the found entry
/// or iterator pointing to the end if entry is /// or iterator pointing to the end if entry is
/// not found. /// not found.
{ {
typename Container::iterator it = _list.begin(); typename Container::iterator it = _list.begin();
typename Container::iterator end = _list.end(); typename Container::iterator itEnd = _list.end();
for(; it != end; ++it) for(; it != itEnd; ++it)
{ {
if (isEqual(it->first, key)) return it; if (isEqual(it->first, key)) return it;
} }
return end; return itEnd;
} }
Iterator insert(const ValueType& val) Iterator insert(const ValueType& val)
@@ -140,24 +140,8 @@ public:
/// Returns iterator pointing to the newly inserted value /// Returns iterator pointing to the newly inserted value
{ {
Iterator it = find(val.first); Iterator it = find(val.first);
while (it != _list.end() && isEqual(it->first, val.first)) ++it;
while (it != _list.end() && isEqual(it->first, val.first)) return _list.insert(it, val);
{
++it;
}
if (it == _list.end())
{
_list.push_back(val);
it = _list.end();
--it;
}
else
{
_list.insert(it, 1, val);
}
return it;
} }
void erase(Iterator it) void erase(Iterator it)
@@ -219,8 +203,8 @@ public:
else else
{ {
ValueType value(key, Mapped()); ValueType value(key, Mapped());
Iterator it = insert(value); Iterator itInsert = insert(value);
return it->second; return itInsert->second;
} }
} }