tree: Abstract away the container type which is used for actual management of children

The motivation behind this change is to enable performance measurement of
different containers. This change only abstracts away the actual type behind a
typedef; the container still has to support the Qt-ish way of access, including
remove(T), takeFirst() etc.

An optimization for batch removal/move is included as well (see the
ObtainSynchronizedMailboxTask.cpp). The old code just didn't make much sense.
tree: Switch to QVector for the list of item children

Benchmarking the testFlagReSyncBenchmark on top of 10k messages with callgrind
suggests that there's roughly a 0.6% speedup here.
tree: switch to std::vector

It appears that the performance is very similar to that of the QVector
Revert "tree: switch to std::vector"

Compared to QVector, an empty std::vector takes three times as much space on
amd64 due to the optimization for shared null. That hurts.

This reverts commit 1916c5f1f35d41893aa93b67bc0676da12fd0d71.
Use QVector for TreeItem child management

This merges a series of commits which try to improve the speed efficiency of
child housekeeping for the in-memory tree which is maintained by the IMAP model.
This is deliberately not squashed into a single commit so that we can later take
a look at which data structure is actually the best one.

Both QVector and std::vector are close contenders; however, in our case QVector
appears to be *slightly* better -- an empty QVector only takes 8 bytes, while an
empty vector takes 24 bytes on my amd64 system. This is a useful optimization on
huge mailboxes as chances are that only a very small subset of messages will be
needed any given time.

std::vector offers slightly better performance, but I'll take the small memeory
saving in this context, I guess.

REVIEW: 114013
Do not use dynamic_cast in inner loops and other hot paths

There isn't much point in checking the correctness of our internal tree
representation all the time. Rough measurements indicate that one can get
another 1% speedup by switching to static_cast at these places.

REVIEW: 114014
tests: simplify the flag building for fake flags
Don't include extra headers
tests: test also compliant FETCH responses

Make sure that we also check the case where the "complicated" identifier is
separated from the rest of the data by a single space, as requested by the RFC.
IMAP: speed up the FETCH response parsing

Previously, the code would happily hit the LowLevelParser::parseList even on the
top-level level, which is rather expensive. Instead of that, this change parses
the individual data fields separately and takes into account the knowledge of
the expected data type. Furthermore, the order in which these fields are checked
against is changed so that FLAGS, UID and MODSEQ are checked first because these
are going to be the most widely encountered entities during mass-syncing, which
was traditionally the bottleneck.

A high-level measurement: the whole test suite takes 9.5 seconds instead of
11.5, i.e. this is a 17.5% speedup.
Switch to faster parsing of FETCH responses

REVIEW: 114015
cmake: add support for the alignof operator from C++11
tree: Use tagged pointers to save memory

This change exploits the fact that the TreeItem structure has to be aligned,
typically to four or 8 bytes. This means that the m_parent cannot ever have the
couple of lowest bits set, so we can merge the m_fetchingState and m_parent into
a single member variable and save memory by that.

REVIEW: