swift
Public Member Functions | Static Public Member Functions | List of all members
swift::misc::CLogCategoryList Class Reference

A sequence of log categories. More...

Inheritance diagram for swift::misc::CLogCategoryList:
[legend]

Public Member Functions

 CLogCategoryList ()=default
 Empty constructor.
 
 CLogCategoryList (const CLogCategory &category)
 By single element.
 
 CLogCategoryList (const CSequence< CLogCategory > &other)
 Copy construct from superclass instance.
 
 CLogCategoryList (std::nullptr_t)=delete
 Prevent accidental use of the initializer list constructor.
 
template<typename T , typename = std::enable_if_t<std::is_class_v<T>>>
 CLogCategoryList (const T *pointer)
 Construct by extracting categories from a class T. More...
 
CLogCategoryList with (const CLogCategory &other) const
 Return a copy with another category appended.
 
CLogCategoryList with (const CLogCategoryList &other) const
 Return a copy with some other categories appended.
 
CLogCategoryList withValidation () const
 Return a copy with validation category appended.
 
QStringList toQStringList () const
 Convert each of the categories to a QString and return the result as a QStringList.
 
QString toQString (bool i18n=false) const
 Cast as QString. More...
 
bool anyStartWith (const QString &prefix) const
 Returns true if any of the categories in the list start with the given prefix.
 
bool anyEndWith (const QString &suffix) const
 Returns true if any of the categories in the list end with the given suffix.
 
QString convertToQString (bool i18n=false) const
 Cast as QString. More...
 
- Public Member Functions inherited from swift::misc::CSequence< CLogCategory >
 CSequence ()=default
 Default constructor.
 
 CSequence (std::initializer_list< CLogCategory > il)
 Initializer list constructor.
 
 CSequence (QList< CLogCategory > &&list)
 By QList of type T.
 
 CSequence (const QList< CLogCategory > &list)
 By QList of type T.
 
 CSequence (It first, It last)
 Range constructor.
 
 CSequence (const CSequence &other)=default
 Copy constructor.
 
 CSequence (CSequence &&other)=default
 Move constructor.
 
CSequenceoperator= (const CSequence &other)=default
 Copy assignment.
 
CSequenceoperator= (CSequence &&other)=default
 Move assignment.
 
 ~CSequence ()=default
 Destructor.
 
QVector< CLogCategorytoVector () const &
 Copy of internal vector.
 
QVector< CLogCategorytoVector () &&
 Copy of internal vector.
 
iterator begin ()
 Returns iterator at the beginning of the sequence.
 
const_iterator begin () const
 Returns const iterator at the beginning of the sequence.
 
const_iterator cbegin () const
 Returns const iterator at the beginning of the sequence.
 
iterator end ()
 Returns iterator one past the end of the sequence.
 
const_iterator end () const
 Returns const iterator one past the end of the sequence.
 
const_iterator cend () const
 Returns const iterator one past the end of the sequence.
 
reverse_iterator rbegin ()
 Returns iterator at the beginning of the reversed sequence.
 
const_reverse_iterator rbegin () const
 Returns const iterator at the beginning of the reversed sequence.
 
const_reverse_iterator crbegin () const
 Returns const iterator at the beginning of the reversed sequence.
 
reverse_iterator rend ()
 Returns iterator at the end of the reversed sequence.
 
const_reverse_iterator rend () const
 Returns const iterator at the end of the reversed sequence.
 
const_reverse_iterator crend () const
 Returns const iterator at the end of the reversed sequence.
 
void swap (CSequence &other) noexcept
 Swap this sequence with another.
 
reference operator[] (size_type index)
 Access an element by its index.
 
const_reference operator[] (size_type index) const
 Access an element by its index.
 
reference front ()
 Access the first element.
 
const_reference front () const
 Access the first element.
 
const_reference frontOrDefault () const
 Access the first element, or a default-initialized value if the sequence is empty.
 
value_type frontOrDefault (value_type def) const
 Access the first element, or a default-initialized value if the sequence is empty.
 
reference back ()
 Access the last element.
 
const_reference back () const
 Access the last element.
 
const_reference backOrDefault () const
 Access the last element, or a default value if the sequence is empty.
 
value_type backOrDefault (value_type def) const
 Access the last element, or a default value if the sequence is empty.
 
size_type size () const
 Returns number of elements in the sequence.
 
int sizeInt () const
 Avoid compiler warnings when using with int.
 
QString sizeString () const
 Convenience function.
 
bool empty () const
 Returns true if the sequence is empty.
 
bool isEmpty () const
 Synonym for empty.
 
void clear ()
 Removes all elements in the sequence.
 
void truncate (size_type maxSize)
 Changes the size of the sequence, if it is bigger than the given size.
 
iterator insert (iterator before, const CLogCategory &value)
 Inserts an element into the sequence. More...
 
iterator insert (iterator before, CLogCategory &&value)
 Moves an element into the sequence. More...
 
void push_back (const CLogCategory &value)
 Appends an element at the end of the sequence.
 
void push_back (CLogCategory &&value)
 Move-appends an element at the end of the sequence.
 
void push_back (const CSequence &other)
 Appends all elements from another sequence at the end of this sequence.
 
void push_back (CSequence &&other)
 Appends all elements from another sequence at the end of this sequence. This version moves elements instead of copying.
 
void push_back (const CRange< I > &range)
 Appends all elements from a range at the end of this sequence.
 
void push_front (const CLogCategory &value)
 Insert as first element.
 
void push_front (const CSequence &other)
 Inserts all elements from another sequence at the beginning of this sequence.
 
void push_front (CLogCategory &&value)
 Move-insert as first element.
 
void push_frontMaxElements (const CLogCategory &value, int maxElements)
 Insert as first element by keep maxElements.
 
void push_backMaxElements (const CLogCategory &value, int maxElements)
 Insert as last element by keep maxElements.
 
CSequence join (const CSequence &other) const
 Concatenates two sequences and returns the result.
 
CSequence join (const CRange< I > &range) const
 Concatenates a sequence and a range and returns the result.
 
void pop_back ()
 Removes an element at the end of the sequence.
 
void pop_front ()
 Removes an element at the front of the sequence.
 
iterator erase (iterator pos)
 Remove the element pointed to by the given iterator. More...
 
iterator erase (iterator it1, iterator it2)
 Remove the range of elements between two iterators. More...
 
iterator find (const CLogCategory &object)
 Return an iterator to the first element equal to the given object, or the end iterator if not found. O(n).
 
const_iterator find (const CLogCategory &object) const
 Return an iterator to the first element equal to the given object, or the end iterator if not found. O(n).
 
CSequence findBy (Predicate p) const
 Return a copy containing only those elements for which a given predicate returns true. More...
 
int applyIf (Predicate p, const VariantMap &newValues, bool skipEqualValues=false)
 Modify by applying a value map to each element for which a given predicate returns true. More...
 
int applyIf (K1 key1, V1 value1, const VariantMap &newValues, bool skipEqualValues=false)
 Modify by applying a value map to each element matching a particular key/value pair. More...
 
int remove (const CLogCategory &object)
 Remove all elements equal to the given object, if it is contained. More...
 
int removeIf (Predicate p)
 Remove elements for which a given predicate returns true. More...
 
int removeIf (K0 k0, V0 v0, KeysValues... keysValues)
 Remove elements matching some particular key/value pair(s). More...
 
int removeIfIn (const CSequence &other)
 Remove all elements if they are in other. More...
 
void removeIfInSubset (const CSequence &other)
 Remove all elements if they are in other. More...
 
int replace (const CLogCategory &original, const CLogCategory &replacement)
 Replace elements matching the given element with a replacement. More...
 
int replaceIf (Predicate p, const CLogCategory &replacement)
 Replace elements for which a given predicate returns true. More...
 
int replaceIf (K1 key1, V1 value1, const CLogCategory &replacement)
 Replace elements matching a particular key/value pair. More...
 
void replaceOrAdd (const CLogCategory &original, const CLogCategory &replacement)
 Replace elements matching the given element. If there is no match, push the new element on the end.
 
void replaceOrAdd (const CLogCategory &replacement)
 Replace elements matching the given element. If there is no match, push the new element on the end.
 
void replaceOrAdd (const CSequence< CLogCategory > &replacements)
 Replace or add given elements.
 
void replaceOrAdd (K1 key1, V1 value1, const CLogCategory &replacement)
 Replace elements matching a particular key/value pair. If there is no match, push the new element on the end. More...
 
void reverse ()
 In-place reverse.
 
Q_REQUIRED_RESULT CSequence reversed () const
 Reversed order.
 
void sort (Predicate p)
 In-place sort by a given comparator predicate.
 
void sortBy (K1 key1, Keys... keys)
 In-place sort by some particular key(s). More...
 
Q_REQUIRED_RESULT CSequence sorted (Predicate p) const
 Return a copy sorted by a given comparator predicate.
 
CSequence sortedBy (K1 key1, Keys... keys) const
 Return a copy sorted by some particular key(s). More...
 
void partiallySort (size_type n, Predicate p)
 In-place move the smallest n elements to the beginning and sort them.
 
void partiallySortBy (size_type n, K1 key1, Keys... keys)
 In-place partially sort by some particular key(s). More...
 
Q_REQUIRED_RESULT CSequence partiallySorted (size_type n, Predicate p) const
 Return a copy with the smallest n elements at the beginning and sorted.
 
CSequence partiallySortedBy (size_type n, K1 key1, Keys... keys) const
 Return a copy partially sorted by some particular key(s). More...
 
bool unorderedEqualsByKeys (const U &other, Key0 k0, Keys... keys) const
 Return true if this container equals another container, considering only the given element members. Order of elements is not considered; this is implemented using a transient sort, so don't overuse.
 
auto separate (Predicate p) const -> QMap< decltype(p(std::declval< CLogCategory >())), CSequence >
 Split up the sequence into subsequences for which the given predicate returns the same value.
 
auto separateBy (Key k) const -> QMap< decltype(std::invoke(k, std::declval< CLogCategory >())), CSequence >
 Split up the sequence into subsequences of elements having the same value for the given key.
 
void marshalToDataStream (QDataStream &stream) const
 Marshal a value to a QDataStream. More...
 
void unmarshalFromDataStream (QDataStream &stream)
 Unmarshal a value from a QDataStream. More...
 
- Public Member Functions inherited from swift::misc::CContainerBase< Derived >
template<template< class > class Other>
auto to () const
 Return a new container of a different type, containing the same elements as this one. More...
 
template<template< class > class Other, class T >
Other< T > to (Other< T > other) const
 Return a new container of a different type, containing the same elements as this one. More...
 
template<class K0 , class V0 , class... KeysValues>
int removeIf (K0 k0, V0 v0, KeysValues... keysValues)
 Remove elements matching some particular key/value pair(s). More...
 
QJsonObject toJson () const
 Cast to JSON object. More...
 
QString toJsonString (QJsonDocument::JsonFormat format=QJsonDocument::Indented) const
 Convenience function JSON as string.
 
void convertFromJson (const QJsonObject &json)
 Assign from JSON object. More...
 
void convertFromJson (const QString &jsonString, bool acceptCacheFormat=false)
 Assign from JSON object string.
 
CStatusMessage convertFromJsonNoThrow (const QJsonObject &json, const CLogCategoryList &categories, const QString &prefix)
 Call convertFromJson, catch any CJsonException that is thrown and return it as CStatusMessage.
 
CStatusMessage convertFromJsonNoThrow (const QString &jsonString, const CLogCategoryList &categories, const QString &prefix)
 Call convertFromJson, catch any CJsonException that is thrown and return it as CStatusMessage.
 
QString convertToQString (bool i18n=false) const
 Cast as QString. More...
 
QStringList toStringList (bool i18n=false) const
 To string list.
 
void marshallToDbus (QDBusArgument &argument) const
 Marshall without begin/endStructure, for when composed within another object. More...
 
void unmarshallFromDbus (const QDBusArgument &argument)
 Unmarshall without begin/endStructure, for when composed within another object. More...
 
- Public Member Functions inherited from swift::misc::CRangeBase< Derived >
template<class F >
auto transform (F function) const
 Return a new container generated by applying some transformation function to all elements of this one.
 
template<class Predicate >
auto findBy (Predicate p) const
 Return a copy containing only those elements for which a given predicate returns true.
 
template<class K0 , class V0 , class... KeysValues>
auto findBy (K0 k0, V0 v0, KeysValues... keysValues) const
 Return a copy containing only those elements matching some particular key/value pair(s). More...
 
template<class Predicate >
const auto & findFirstBy (Predicate p) const
 Return a reference to the first element for which a given predicate returns true. Undefined if there is none.
 
template<class K , class V >
const auto & findFirstBy (K key, V value) const
 Return a reference to the first element matching some particular key/value pair(s). Undefined if there is none.
 
template<class Predicate , class Value >
auto findFirstByOrDefault (Predicate p, const Value &def) const
 Return a copy of the first element for which a given predicate returns true, or a default value if there is none.
 
template<class Predicate >
auto findFirstByOrDefault (Predicate p) const
 Return a copy of the first element for which a given predicate returns true, or a default value if there is none.
 
template<class K , class V , class Value >
auto findFirstByOrDefault (K key, V value, const Value &def) const
 Return a copy of the first element matching some particular key/value pair(s), or a default value if there is none.
 
template<class T , class K , class V >
auto findFirstByOrDefault (K T::*key, V value) const
 Return a copy of the first element matching some particular key/value pair(s), or a default value if there is none.
 
template<class Predicate >
bool containsBy (Predicate p) const
 Return true if there is an element for which a given predicate returns true.
 
template<class T >
bool contains (const T &object) const
 Return true if there is an element equal to given object. Uses the most efficient implementation available in the derived container.
 
template<class K0 , class V0 , class... KeysValues>
bool contains (K0 k0, V0 v0, KeysValues... keysValues) const
 Return a copy containing only those elements matching some particular key/value pair(s). More...
 
template<class T , class Predicate >
bool equalsBy (const T &other, Predicate c) const
 Return true if this container equals another container according to the given element equality predicate.
 
template<class T , class Key0 , class... Keys>
bool equalsByKeys (const T &other, Key0 k0, Keys... keys) const
 Return true if this container equals another container, considering only the given element members.
 
template<class T >
randomElement () const
 Pick one random element.
 
Derived randomElements (int n) const
 Copy n elements from the container at random.
 
Derived sampleElements (int n) const
 Copy n elements from the container, randomly selected but evenly distributed.
 
- Public Member Functions inherited from swift::misc::mixin::MetaType< Derived >
int getMetaTypeId () const
 Returns the Qt meta type ID of this object. More...
 
QString getClassName () const
 Class name.
 
bool isA (int metaTypeId) const
 Returns true if this object is an instance of the class with the given meta type ID, or one of its subclasses.
 
- Public Member Functions inherited from swift::misc::mixin::String< Derived >
QString toQString (bool i18n=false) const
 Cast as QString.
 
std::string toStdString (bool i18n=false) const
 To std string.
 
QString stringForStreaming () const
 String for streaming operators.
 
- Public Member Functions inherited from swift::misc::mixin::Icon< Derived, IconIndex >
CIcons::IconIndex toIcon () const
 As icon, not implemented by all classes.
 
- Public Member Functions inherited from swift::misc::mixin::MetaType< CLogCategoryList >
int getMetaTypeId () const
 Returns the Qt meta type ID of this object. More...
 
QString getClassName () const
 Class name.
 
bool isA (int metaTypeId) const
 Returns true if this object is an instance of the class with the given meta type ID, or one of its subclasses.
 

Static Public Member Functions

static CLogCategoryList fromQStringList (const QStringList &stringList)
 Convert a string list, such as that returned by toQStringList(), into a CLogCategoryList.
 
static CLogCategoryList fromQString (const QString &string)
 Convert a string, such as that returned by toQString(), into a CLogCategoryList.
 
static void registerMetadata ()
 Register metadata.
 
- Static Public Member Functions inherited from swift::misc::CContainerBase< Derived >
static Derived fromJson (const QJsonObject &json)
 Static version of convertFromJson.
 
static Derived fromJson (const QString &jsonString, bool acceptCacheJson=false)
 Static version of convertFromJson.
 
static Derived fromJsonNoThrow (const QString &jsonString, bool acceptCacheJson, bool &success, QString &errMsg)
 Static version of convertFromJson.
 
- Static Public Member Functions inherited from swift::misc::mixin::MetaType< Derived >
static void registerMetadata ()
 Register metadata.
 
- Static Public Member Functions inherited from swift::misc::mixin::MetaType< CLogCategoryList >
static void registerMetadata ()
 Register metadata.
 

Additional Inherited Members

- Public Types inherited from swift::misc::CSequence< CLogCategory >
typedef CLogCategory key_type
 STL compatibility.
 
typedef CLogCategory value_type
 STL compatilibty.
 
typedef CLogCategoryreference
 STL compatibility.
 
typedef const CLogCategoryconst_reference
 STL compatibility.
 
typedef CLogCategorypointer
 STL compatibility.
 
typedef const CLogCategoryconst_pointer
 STL compatibility.
 
typedef QVector< CLogCategory >::const_iterator const_iterator
 STL compatibility.
 
typedef QVector< CLogCategory >::iterator iterator
 STL compatibility.
 
typedef QVector< CLogCategory >::const_reverse_iterator const_reverse_iterator
 STL compatibility.
 
typedef QVector< CLogCategory >::reverse_iterator reverse_iterator
 STL compatibility.
 
typedef ptrdiff_t difference_type
 STL compatibility.
 
typedef int size_type
 STL compatibility.
 
- Protected Member Functions inherited from swift::misc::CContainerBase< Derived >
int getMetaTypeId () const
 Returns the Qt meta type ID of this object. More...
 
- Static Protected Member Functions inherited from swift::misc::CRangeBase< Derived >
template<typename T , typename U >
static bool equalPointers (const T *a, const U *b)
 Efficiently compare addresses of two objects. Return false if types are not compatible.
 

Detailed Description

A sequence of log categories.

Definition at line 34 of file logcategorylist.h.

Constructor & Destructor Documentation

◆ CLogCategoryList()

template<typename T , typename = std::enable_if_t<std::is_class_v<T>>>
swift::misc::CLogCategoryList::CLogCategoryList ( const T *  pointer)
inline

Construct by extracting categories from a class T.

If T has a member function getLogCategories, then this will be called. If T inherits from QObject then we get the name of the class and all its superclasses. If T is registered with QMetaType then we get the name of the class. If more than one of the above cases is true, then all are combined into the list. If none of the above cases is true, then the constructed list will be the uncategorized category.

This constructor will be disabled if T is not a class type.

Parameters
pointerThe value of pointer is unimportant. Only the static type T is considered. It is legal to pass static_cast<T>(nullptr), but in member functions passing the this pointer is easier.

Definition at line 68 of file logcategorylist.h.

Member Function Documentation

◆ convertToQString()

QString swift::misc::CLogCategoryList::convertToQString ( bool  i18n = false) const

Cast as QString.

Definition at line 32 of file logcategorylist.cpp.

◆ toQString()

QString swift::misc::CLogCategoryList::toQString ( bool  i18n = false) const

Cast as QString.

Definition at line 30 of file logcategorylist.cpp.


The documentation for this class was generated from the following files: