This does not cover Utils::MapReduceOption with QVector, and code
that's not compiled on my machine.
Change-Id: Ib63923985c52b1bb74e5ec2068a2bb37469ac618
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Add a signal triggered by project files becoming dirty and add
a way to register more project files than just the default with the
project.
This change enables getting rid of filesystemwatchers in derived
classes.
Change-Id: If985b46edf7cb88dd49f1c574f35cf13b5ce82d4
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
As replacement for functionality that's being deprecated
in Qt but still useful or needed, or that cannot easily be handled
without resorting to #if QT_VERSION checks in user code.
Change-Id: Id3575a54ff944bf0e89d452d13944fcaee270208
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
It contains so much nowadays, and parts of it require internal
functions, so it became hard to actually find out what algorithms we
provide.
Put declarations of the "public" functions at the top of the file, to
make them more discoverable.
Change-Id: I99456e1023a6f39223d09a2936995b8fa6dc5cb0
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
std::set_union in libC++ is broken for move iterators. We has to use
temporarily our own implementation which can be removed if we move to a
newer version of XCode.
Task-number: QTCREATORBUG-22246
Change-Id: I8fccc8aab5f8af738aa2e589ba65924363cd818d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
So you can type Utils::usize(qVector) == Utils::usize(stdVector) without a
warning. You can write qVector.reserve(Utils::ssize(stdVector) etc..
Change-Id: If5b93b7daa8d4126cf588b0f025b99444bc8e8af
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
And fix some details of the implementations.
Change-Id: I8e77fee4b95658a69ef1656bb406811de091ce16
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
It works with contiguous arrays like std::vector but it is not so useful
for other containers anyway. Use the iterator interface for std::array.
Change-Id: I9f5dd665d38ca642bbd81e1925445127ea579c22
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Utils::setUnionMerge is an extension of std::set_union. It is not assigning
but merging equal matching values. For example two project part with the
same id will be merged in one by the merge function.
Change-Id: Ia244a7c1ff84dfdbd30f7101ed1ccbfb88393c7d
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: hjk <hjk@qt.io>
Many issues, mostly in headers, were not addressed in
e38410b76c
modernize-use-auto
modernize-use-nullptr
modernize-use-override
modernize-use-using
modernize-use-default-member-init
modernize-use-equals-default
Change-Id: I320a51726db881e582b898948d53735ebb06887a
Reviewed-by: hjk <hjk@qt.io>
Casting all elements of a container, similar to qobject_container_cast.
Change-Id: Ib455fe8c7fa0d4acda7e29685c3100638a0152f8
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
When transforming between containers with different size_type, like
QList and std::vector.
Change-Id: Ife28aacdc8627e81901579cde8b563da1408d084
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Add a new algorithmn to take the first match in a container out of the container.
It takes a pointer to something and will try to match against a smart pointer
stored in the container. Besides that it also accepts the usual like a predicate,
member variable or member function.
Change-Id: I4aabd4d43aa076a534da6488d0f9c3695ba79c09
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Add support for output as std::map/unordered_map/set and QMap and QHash,
when giving the full result type as template argument. For std::
(unordered_)map, the function must return a std::pair<Key,Value>, for
QMap and QHash it can also be QPair<Key,Value>.
Change-Id: If3dff17ab6aa5d1b11abc244813fd885d10c75a4
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Support containers without reserve() as result container, for example
std::set/deque/list
Change-Id: Ia96b834c67d5ee74bfb9de2cf6b86639f6b3d5d7
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Sometimes you want to get raw pointer container from smart pointer
container and reference container from value container.
Change-Id: Ia018d572ac0a7bf742f3937dc38ee30670a3ca73
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Can come in handy when the function or member does not directly return
the right value type for the result list, but is implicitly convertable
to it. For example from pointer to class to pointer to superclass, or
from int to double.
const auto result
= Utils::transform<QVector<double>>(v, &ValueType::intMember)
Change-Id: I0e1914d70bb2580b91098dd37e85a31ca14b0ae6
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Move variadic template arguments to the end for all users in algorithm.h.
Change-Id: I7c8f1254e7de6ee9737e73d1a4721e71c188438e
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Support std::vector and similar classes as input and output.
Change-Id: I1d202d54c18e868ce0e71e4c2b6288565710baa8
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Consistently use anyOf to implement contains.
* Support contains over an container of std::unique_ptr matching a pointer.
Change-Id: I0180f3ec3d5935d8afeeac67a745d4b38a01674d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Add function that casts QObjects of a given container to a desired type
and return the result via the same container with the desired value
type.
Change-Id: I45949c982c8dbdd0cce069d62cd2db5c8517f9f5
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Many STL algorithms have value version. So you can only use a predicate:
std::stable_partition(std::begin(list), std::end(list), [](int entry) {
return entry < 20;
});
With this predicates you can write it in a shorter form:
std::stable_partition(std::begin(list), std::end(list), lessThan(20));
The find helpers are moved to predicates too.
Change-Id: I791b3105ca84ef7c5a519d22589a91b5548cf3e4
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Pass the mapping from custom enum to text style in form of a function,
which then can use a switch which is checked by compilers, and
avoids the need to lookup a different enum somewhere else to find
out what the mapping actually is.
That mapping is cached to keep performance as before.
Also, most highlighters created an enum just for the purpose of mapping
to text styles, basically creating duplicated subsets of text style like
enums everywhere. Instead provide a default, identity mapping from text
styles to text styles.
Change-Id: I2ea1ca702b99e36b8742dfda510b1b2753f0a1c2
Reviewed-by: David Schulz <david.schulz@qt.io>
It is seen as good practice to use Container::reserve if you know the size
in advance.
Change-Id: If1398eaa099f4d3f657778aca46516f9bdec14c9
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Avoids some code duplication. Available with C++14 / GCC>=4.9.
Change-Id: Iae90466ec9620ffc84b7a45a55490f5fbc8c5b74
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Available now after switching to C++14 and GCC>=4.9
Change-Id: I44e9859a6abe66db16d77b228466b65eadced8ae
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This reverts commit defb18aef4.
This reverts commit 602f8e72be.
The refactoring of transform does not compile with
MSVC2015 Update 2. Retry when we can upgrade to update 3.
Change-Id: I8bfd6ad12c71759af4840c2615d9a8f2390fd4bc
Reviewed-by: Eike Ziller <eike.ziller@qt.io>