|
Multi diag tools
|
Some helper that could be usefull. More...
Functions | |
| QString | removeFirstLastCharIf (const QString &str, QChar c) |
| Get a string with first and last char removed in str if they match c. | |
| int | indexOfFirstEscapedToken (const QString &str, int from, const std::vector< QChar > &tokens, const QChar &escape) |
| Find the first token that is escaped in str. More... | |
| QString | unescapeEscapedTokens (const QString &str, const std::vector< QChar > &tokens, const QChar &escape) |
| Get a string in which each escaped token is unescaped. More... | |
| int | indexOfFirstNonEscapedToken (const QString &str, int from, const std::vector< QChar > &tokens, const QChar &escape) |
| Find the first token that is not escaped in str. More... | |
| QString | replaceNonEscapedTokens (const QString &str, const std::initializer_list< std::pair< QChar, QString > > &replaceList, const QChar &escape) |
| Get a string in which each non escaped token is replaced. More... | |
| template<typename ForwardIt , typename OutputIt , typename UnaryPredicate > | |
| ForwardIt | moveIf (ForwardIt first, ForwardIt last, OutputIt d_first, UnaryPredicate p) |
| Move a range of elements to a new location. More... | |
| template<typename SourceContainer , typename DestinationContainer , typename UnaryPredicate > | |
| void | moveIf (SourceContainer &sourceConatiner, DestinationContainer &destinationContainer, UnaryPredicate p) |
| Move a range of elements to a new location. More... | |
Some helper that could be usefull.
| int MDT_ALGORITHM_EXPORT Mdt::Algorithm::indexOfFirstEscapedToken | ( | const QString & | str, |
| int | from, | ||
| const std::vector< QChar > & | tokens, | ||
| const QChar & | escape | ||
| ) |
Find the first token that is escaped in str.
| str | String in which to find token |
| from | Index in str from which to start |
| tokens | List of elements that are tokens |
| escape | Char that is used to escape |
Example:
Definition at line 43 of file Algorithm.cpp.
| int MDT_ALGORITHM_EXPORT Mdt::Algorithm::indexOfFirstNonEscapedToken | ( | const QString & | str, |
| int | from, | ||
| const std::vector< QChar > & | tokens, | ||
| const QChar & | escape | ||
| ) |
Find the first token that is not escaped in str.
| str | String in which to find token |
| from | Index in str from which to start |
| tokens | List of elements that are tokens |
| escape | Char that is used to escape |
Example:
Definition at line 87 of file Algorithm.cpp.
| ForwardIt Mdt::Algorithm::moveIf | ( | ForwardIt | first, |
| ForwardIt | last, | ||
| OutputIt | d_first, | ||
| UnaryPredicate | p | ||
| ) |
Move a range of elements to a new location.
template<typename ForwardIt, typename OutputIt, typename UnaryPredicate> void moveIf(ForwardIt first, ForwardIt last, OutputIt d_first, UnaryPredicate p);
template<typename SourceContainer, typename DestinationContainer, typename UnaryPredicate> void moveIf(SourceContainer & sourceConatiner, DestinationContainer & destinationContainer, UnaryPredicate p);
Move the elements, for which the predicate p returns true, from range [first, last) to range d_first .
| first | The beginnig of the source range |
| last | The end of the source range |
| d_first | |
| p | The unary predicate which returns true if a element must be moved. The signature of the predicate function should be equivalent to the following: bool pred(const Type & value); |
Example:
sourceList will contain A,C abd destinationList will contain B .
Definition at line 188 of file Algorithm.h.
| void Mdt::Algorithm::moveIf | ( | SourceContainer & | sourceConatiner, |
| DestinationContainer & | destinationContainer, | ||
| UnaryPredicate | p | ||
| ) |
Move a range of elements to a new location.
Move the elements, for which the predicate p returns true, from sourceConatiner to destinationContainer .
| p | The unary predicate which returns true if a element must be moved. The signature of the predicate function should be equivalent to the following: bool pred(const Type & value); |
Example:
sourceList will contain A,C abd destinationList will contain B .
Definition at line 225 of file Algorithm.h.
| QString MDT_ALGORITHM_EXPORT Mdt::Algorithm::replaceNonEscapedTokens | ( | const QString & | str, |
| const std::initializer_list< std::pair< QChar, QString > > & | replaceList, | ||
| const QChar & | escape | ||
| ) |
Get a string in which each non escaped token is replaced.
| str | String in which to search tokens to replace |
| replaceList | List of replacement par. For each pair, first is the token to match and second is its replacement |
| escape | Char that is used to escape |
Example:
Definition at line 119 of file Algorithm.cpp.
| QString MDT_ALGORITHM_EXPORT Mdt::Algorithm::unescapeEscapedTokens | ( | const QString & | str, |
| const std::vector< QChar > & | tokens, | ||
| const QChar & | escape | ||
| ) |
Get a string in which each escaped token is unescaped.
| str | String in which to find escaped tokens |
| tokens | List of elements that are tokens |
| escape | Char that is used to escape |
Example:
Definition at line 66 of file Algorithm.cpp.
1.8.11