|
swift
|
Free functions in swift::misc. More...
Namespaces | |
| GeoPosition | |
| Position handling as geo locations and coordinates systems. | |
| Iterators | |
| Iterator classes for the containers. | |
| mixin | |
| Mixin classes which implement common operations for value classes. | |
| predicates | |
| Functor classes for evaluating predicate calculus expressions. | |
| settings | |
| Classes related to configuration settings. | |
| shared_state | |
| Utilities for sharing state between multiple objects. | |
| test | |
| Generate data for testing purposes. | |
Classes | |
| class | CApplicationInfo |
| Description of a swift application. More... | |
| class | CApplicationInfoList |
| List of swift application descriptions. More... | |
| class | CAtomicFile |
| A subclass of QFile which writes to a temporary file while it is open, then renames the file when it is closed, so that it overwrites the target file as a single, atomic transaction. More... | |
| class | CCacheSettingsUtils |
| Utils for copying cache and settings content. More... | |
| class | QOrderedSet |
| Needed for compatibility with C++ standard algorithms which expect ordered sets. More... | |
| class | CCollection |
| Generic ordered container with value semantics. More... | |
| class | CCompressUtils |
| Compress utilities. More... | |
| class | CConnectionGuard |
| List of QMetaObject::Connection. More... | |
| class | CContainerHelper |
| Class providing static helper methods for different containers. More... | |
| class | CContainerBase |
| Base class for CCollection and CSequence adding mutating operations and CValueObject facility on top of CRangeBase. More... | |
| class | CCountry |
| Color. More... | |
| class | CCountryList |
| Value object encapsulating a list of countries. More... | |
| class | CCrashHandler |
| Crash handler. More... | |
| class | CCrashInfo |
| Crash info. More... | |
| class | CDataCacheRevision |
| Encapsulates metastate about how the version of the cache in memory compares to the one on disk. More... | |
| class | CDataCacheSerializer |
| Worker which performs (de)serialization on behalf of CDataCache, in a separate thread so that the main thread is not blocked by (de)serialization of large objects. More... | |
| class | CDataCache |
| Singleton derived class of CValueCache, for core dynamic data. More... | |
| class | CData |
| Class template for accessing a specific value in the CDataCache. More... | |
| class | CDataReadOnly |
| Class template for read-only access to a specific value in the CDataCache. More... | |
| struct | TDataTrait |
| Base class for traits to be used as template argument to swift::misc::CData. More... | |
| class | CDBusServer |
| Custom DBusServer. More... | |
| class | CDBusUtils |
| Utils for UNIT tests / samples. More... | |
| class | CDictionary |
| Associative container with value semantics, chooses a sensible default implementation container type. More... | |
| class | CDigestSignal |
| Receive 1..n signals, collect them over time, and resend afer n milliseconds. More... | |
| class | CDirectories |
| Directories (swift data directories) More... | |
| class | CDirectoryUtils |
| Utility class for directory operations. More... | |
| class | CEventLoop |
| Utility class which blocks until a signal is emitted or timeout reached. More... | |
| class | CFileLogger |
| Class to write log messages to file. More... | |
| class | CFileUtils |
| Utility class for file operations. More... | |
| class | CGenericDBusInterface |
| Used for hand written interface based on virtual methods. More... | |
| class | CIcon |
| Value object for icons. An icon is stored in the global icon repository and identified by its index. It contains no(!) pyhsical data for the icon itself. More... | |
| class | CIconList |
| Icon list (swift standard icons) More... | |
| class | CIcons |
| Standard icons. More... | |
| class | CIdentifiable |
| Base class with a member CIdentifier to be inherited by a class which has an identity in the environment of modular distributed swift processes. More... | |
| class | CIdentifier |
| Value object encapsulating information identifying a component of a modular distributed swift process (core, GUI, audio) More... | |
| class | CIdentifierList |
| Value object encapsulating a list of object identifiers. More... | |
| struct | TBaseOf |
| If T has a member typedef base_type, this trait will obtain it, otherwise void. More... | |
| struct | TMetaBaseOf |
| It T has a member typedef base_type which is a registered metatype, this trait will obtain it, otherwise void. More... | |
| struct | TIndexBaseOf |
| If T has a member typedef base_type which has a member propertyByIndex, this trait will obtain it, otherwise void. More... | |
| class | CJsonException |
| Thrown when a convertFromJson method encounters an unrecoverable error in JSON data. More... | |
| class | CJsonScope |
| Pseudo-RAII pattern that tracks the current JSON value being converted. More... | |
| class | LockFree |
| Lock-free wrapper for synchronizing multi-threaded access to an object. More... | |
| class | LockFreeReader |
| Return value of LockFree::read(). More... | |
| class | LockFreeUniqueWriter |
| Return value of LockFree::uniqueWrite(). More... | |
| class | LockFreeSharedWriter |
| Return value of LockFree::sharedWrite(). More... | |
| class | LockFreeMulti |
| Compose multiple LockFreeReader or LockFreeUniqueWriter instances. More... | |
| class | CLogCategories |
| Predefined special log categories. More... | |
| class | CLogCategory |
| A log category is an arbitrary string tag which can be attached to log messages. More... | |
| class | CLogCategoryList |
| A sequence of log categories. More... | |
| class | CLogHandler |
| Class for subscribing to log messages. More... | |
| class | CLogPatternHandler |
| A class for subscribing to log messages which match particular patterns. More... | |
| class | CLogSubscriber |
| A helper class for subscribing to log messages matching a particular pattern, with the ability to change the pattern at runtime. More... | |
| class | CLogHistory |
| Records all log messages to a list that persists for the lifetime of the application. More... | |
| class | CLogHistorySource |
| Allows distributed insertion of log messages into a central CLogHistory. More... | |
| class | CLogHistoryReplica |
| Allows distributed access to the log messages of a central CLogHistory. More... | |
| class | CLogMessage |
| Class for emitting a log message. More... | |
| class | CLogPattern |
| Value class for matching log messages based on their categories. More... | |
| class | CMacOSMicrophoneAccess |
| Wrapper around MacOS 10.14 AVCaptureDevice AVCaptureDevice authorization. More... | |
| class | CMapBuilder |
| Build a QMap more efficiently when calling insert() in a for loop. More... | |
| class | CMemoTable |
| A data memoization pattern useful for compressing JSON representations of containers. More... | |
| struct | CMemoHelper |
| Helper class for memoizing members of a value object. More... | |
| struct | CExplicitLatin1String |
| Simple literal type containing a single QLatin1String. More... | |
| struct | MetaFlags |
| Type wrapper for passing MetaFlag to CMetaMember::has. More... | |
| struct | CMetaMember |
| Literal aggregate type representing attributes of one member of a value class. More... | |
| struct | CMetaMemberList |
| Literal aggregate type representing attributes of the members of a value class. More... | |
| class | CMetaClass |
| Base class for meta classes. More... | |
| class | CMetaClassIntrospector |
| An introspector for a metaclass. More... | |
| class | LosslessTag |
| Tag type signifying overloaded marshalling methods that preserve data at the expense of size. More... | |
| class | CNameVariantPair |
| Value / variant pair. More... | |
| class | CNameVariantPairList |
| Value object encapsulating a list of name/variant pairs. More... | |
| class | CObfuscation |
| Utility class to obfuscate strings in the source code to make them unreadable. More... | |
| class | Optional |
| Own implementation of std::optional. More... | |
| class | IOrderable |
| Entity with order attribute (can be manually ordered in views) More... | |
| class | IOrderableList |
| List of orderable IOrderable objects. More... | |
| class | CPixmap |
| Pixmap which can be transferred via DBus. More... | |
| class | CPlatform |
| Platform (i.e. More... | |
| class | CPlatformSet |
| Value object for a set of platforms. More... | |
| class | CProcessCtrl |
| Wrapper around QProcess with additional features. More... | |
| class | CProcessInfo |
| Value class identifying a process, with a PID and a name. More... | |
| class | CPromise |
| A promise-based interface to QFuture, similar to std::promise for std::future. More... | |
| class | CPromise< void > |
| Specialization of CPromise for void futures. More... | |
| class | CPropertyIndex |
| Property index. More... | |
| class | CPropertyIndexList |
| Value object encapsulating a list of property indexes. More... | |
| class | CPropertyIndexRef |
| Non-owning reference to a CPropertyIndex with a subset of its features. More... | |
| class | CPropertyIndexVariantMap |
| Specialized value object compliant map for variants, based on indexes. More... | |
| class | IProvider |
| Base class for providers. More... | |
| class | IProviderAware |
| Base class of provider aware classes. More... | |
| class | CRange |
| A range is a conceptual container which does not contain any elements of its own, but is constructed from a begin iterator and an end iterator of another container. More... | |
| class | CRangeBase |
| Any container class with begin and end iterators can inherit from this CRTP class to gain some useful algorithms as member functions. More... | |
| class | CRgbColor |
| Color. More... | |
| class | CSequence |
| Generic sequential container with value semantics. More... | |
| class | CSetBuilder |
| Build a QSet more efficiently when calling insert() in a for loop. More... | |
| class | CSettingsCache |
| Singleton derived class of CValueCache, for settings. More... | |
| class | CSetting |
| Class template for accessing a specific value in the CSettingsCache. More... | |
| class | CSettingReadOnly |
| Class template for accessing a specific value in the CSettingsCache. More... | |
| struct | TSettingTrait |
| Base class for traits to be used as template argument to swift::misc::CSetting. More... | |
| class | CSimpleCommandParser |
| Utility methods for simple line parsing used with the command line. More... | |
| class | CSlot |
| Callable wrapper for a member function with function signature F. More... | |
| class | CSlot< R(Args...)> |
| Callable wrapper for a member function with function signature R(Args...). More... | |
| class | CStatusException |
| Throwable exception class containing a CStatusMessage. More... | |
| class | CStrongStringView |
| Special-purpose string class used by CMessageBase. More... | |
| class | CMessageBase |
| Base class for CStatusMessage and CLogMessage. More... | |
| class | CStatusMessage |
| Streamable status message, e.g. More... | |
| class | CStatusMessageList |
| Status messages, e.g. from Core -> GUI. More... | |
| struct | TString |
| Stringification traits class. More... | |
| class | CSwiftDirectories |
| Locations of important directories for swift files. More... | |
| class | CThreadedTimer |
| Thread-safe timer class. More... | |
| class | CThreadUtils |
| Utility class for threaded operations. More... | |
| class | ITimestampBased |
| Entity with timestamp. More... | |
| class | ITimestampWithOffsetBased |
| Entity with timestamp. More... | |
| struct | MillisecondsMinMaxMean |
| Milliseconds minimum/maximum/mean. More... | |
| class | ITimestampObjectList |
| List of objects with timestamp. Such objects should implement. More... | |
| class | ITimestampWithOffsetObjectList |
| List of objects with timestamp and offset. Such objects should implement. More... | |
| class | CTokenBucket |
| Token bucket algorithm. More... | |
| struct | TParameter |
| Trait to detect properties of function parameter types. More... | |
| struct | THasToQString |
| Trait to detect whether T contains a member function toQString. More... | |
| struct | THasPushBack |
| Trait which is true if the expression a.push_back(v) is valid when a and v are instances of T and T::value_type. More... | |
| struct | THasGetLogCategories |
| Trait to detect whether a class T has a static member function named getLogCategories. More... | |
| struct | TModelsQHashKey |
| Trait to detect whether a class T can be used as a key in a QHash. More... | |
| struct | TModelsQMapKey |
| Trait to detect whether a class T can be used as a key in a QMap. More... | |
| struct | THasCompare |
| Trait which is true if the expression compare(a, b) is valid when a and b are instances of T and U. More... | |
| struct | THasComparePropertyByIndex |
| Trait which is true if the expression a.compareByPropertyIndex(b, i) is valid when a and b are instances of T, and i is an instance of CPropertyIndexRef. More... | |
| struct | THasPropertyByIndex |
| Trait which is true if the expression a.propertyByIndex(i) is valid with a is an instance of T and i is an instance of CPropertyIndexRef. More... | |
| struct | TIsEqualityComparable |
| Trait which is true if the expression a == b is valid when a and b are instances of T and U. More... | |
| struct | THasMarshallMethods |
| Trait which is true if T has methods marshallToDbus and unmarshallFromDbus. More... | |
| struct | TIsQPrivateSignal |
| Trait that detects if a type is QPrivateSignal. More... | |
| class | CValueCachePacket |
| Value class used for signalling changed values in the cache. More... | |
| class | CValueCache |
| Manages a map of { QString, CVariant } pairs, which can be distributed among multiple processes. More... | |
| class | CCached |
| Provides access to one of the values stored in a CValueCache. More... | |
| class | CEmpty |
| Default base class for CValueObject. More... | |
| class | CValueObject |
| Mix of the most commonly used mixin classes. More... | |
| class | CVariant |
| Wrapper around QVariant which provides transparent access to CValueObject methods of the contained object if it is registered with swift::misc::registerMetaValueType. More... | |
| class | CVariantList |
| Value object encapsulating a list of variants. More... | |
| class | CVariantMap |
| Map of { QString, CVariant } pairs. More... | |
| class | CWinDllUtils |
| Functions dealing with Windows DLLs. More... | |
| class | CRegularThread |
| Just a subclass of QThread whose destructor waits for the thread to finish. More... | |
| class | CWorkerBase |
| Base class for CWorker and CContinuousWorker. More... | |
| class | CWorker |
| Class for doing some arbitrary parcel of work in its own thread. More... | |
| class | CContinuousWorker |
| Base class for a long-lived worker object which lives in its own thread. More... | |
| class | CSampleUtils |
| Utils for sample programms. More... | |
| class | CTestValueObject |
| Test value object. More... | |
Typedefs | |
| template<typename K , typename V > | |
| using | TDefaultAssociativeType = typename private_ns::TAssociativityTraits< TModelsQHashKey< K >::value, TModelsQMapKey< K >::value >::template DefaultType< K, V > |
| Trait to select the appropriate default associative container type depending on what the key type supports. | |
| template<class T > | |
| using | TBaseOfT = typename TBaseOf< T >::type |
| Alias for typename TBaseOf<T>::type. | |
| template<class T > | |
| using | TMetaBaseOfT = typename TMetaBaseOf< T >::type |
| Alias for typename TMetaBaseOf<T>::type. | |
| template<class T > | |
| using | TIndexBaseOfT = typename TIndexBaseOf< T >::type |
| Alias for typename TIndexBaseOf<T>::type. | |
Enumerations | |
| enum | MetaFlag { DisabledForComparison = 1 << 0 , DisabledForMarshalling = 1 << 1 , DisabledForDebugging = 1 << 2 , DisabledForHashing = 1 << 3 , DisabledForJson = 1 << 4 , CaseInsensitiveComparison = 1 << 5 , LosslessMarshalling = 1 << 6 , RequiredForJson = 1 << 7 } |
| Metadata flags attached to members of a meta class. More... | |
| enum | StatusSeverity { SeverityDebug , SeverityInfo , SeverityWarning , SeverityError } |
| Status severities. | |
| enum class | ParameterPassBy { Value , ConstRef } |
| Whether an input parameter type should be passed by value or by const reference. | |
Functions | |
| template<typename I , typename J > | |
| auto | removeIfIn (I begin1, I end1, J begin2, J end2) |
| Removes those elements in range 1 that appear also in range 2 leaving only those that do not appear in range 2. More... | |
| template<typename ForwardIt , typename OutputIt , typename Generator > | |
| void | copyRandomElements (ForwardIt in, ForwardIt end, OutputIt out, int n, Generator &&rng) |
| Use the random number generator rng to choose n elements from the range [in,end) and copy them to out. | |
| template<typename ForwardIt , typename OutputIt > | |
| void | copyRandomElements (ForwardIt in, ForwardIt end, OutputIt out, int n) |
| Randomly choose n elements from the range [in,end) and copy them to out. | |
| template<typename ForwardIt , typename OutputIt , typename Generator > | |
| void | copySampleElements (ForwardIt in, ForwardIt end, OutputIt out, int n, Generator &&rng) |
| Split the range [in,end) into n equal chunks and use the random number generator rng to choose one element from each. | |
| template<typename ForwardIt , typename OutputIt > | |
| void | copySampleElements (ForwardIt in, ForwardIt end, OutputIt out, int n) |
| Split the range [in,end) into n equal chunks and randomly choose one element from each. | |
| template<typename I , typename F > | |
| void | topologicalSort (I begin, I end, F comparator) |
| Topological sorting algorithm. More... | |
| template<typename C , typename T , typename F > | |
| void | topologicallySortedInsert (C &container, T &&value, F comparator) |
| Insert an element into a sequential container while preserving the topological ordering of the container. More... | |
| template<typename T , typename F > | |
| void | tupleForEachPair (T &&tuple, F &&visitor) |
| Invoke a visitor function on each pair of elements of a tuple in order. | |
| int | getProcessCpuTimeMs () |
| Get the time in milliseconds that the CPU has spent executing the current process. More... | |
| int | getThreadCpuTimeMs () |
| Get the time in milliseconds that the CPU has spent executing the current thread. | |
| template<class Key , class Value > | |
| QMap< Key, Value > & | implementationOf (QMap< Key, Value > &dict) |
| Identity function for API consistency with CDictionary::implementationOf. | |
| template<class Key , class Value > | |
| const QMap< Key, Value > & | implementationOf (const QMap< Key, Value > &dict) |
| Identity function for API consistency with CDictionary::implementationOf. | |
| template<class Map1 , class Map2 , class F > | |
| void | forEachIntersection (const Map1 &map1, const Map2 &map2, F functor) |
| Call a functor for each {key,value1,value2} triple in the keywise intersection of two maps. | |
| QString | applicationName () |
| Get application name. | |
| QString | logFileName () |
| Get log file name. | |
| QString | toHtmTable (const QStringList &values, int columns) |
| Values as HTML table. | |
| QString | asHyperlink (const QString &url, const QString &text="") |
| As hyperlink. | |
| SWIFT_MISC_EXPORT bool | pixmapToPngByteArray (const QPixmap &pixmap, QByteArray &array) |
| Pixmap to PNG byte array. | |
| SWIFT_MISC_EXPORT QPixmap | pngByteArrayToPixmap (const QByteArray &array) |
| Pixmap from PNG byte array. | |
| SWIFT_MISC_EXPORT bool | pngByteArrayToPixmapRef (const QByteArray &array, QPixmap &pixmap) |
| Pixmap from PNG byte array. | |
| SWIFT_MISC_EXPORT QString | pixmapToPngHexString (const QPixmap &pixmap) |
| Pixmap as HEX string (for PNG image) | |
| SWIFT_MISC_EXPORT QPixmap | pngHexStringToPixmap (const QString &hexString) |
| Hex encoded pixmap string to Pixmap. | |
| SWIFT_MISC_EXPORT bool | pngHexStringToPixmapRef (const QString &hexString, QPixmap &pixmap) |
| Hex encoded pixmap string to Pixmap. | |
| SWIFT_MISC_EXPORT QPixmap | iconToPixmap (const QIcon &icon) |
| Icon to pixmap. | |
| template<typename... Ts> | |
| LockFreeMulti< LockFreeReader, const Ts... > | multiRead (const LockFree< Ts > &...vs) |
| Return a callable object for reading from multiple LockFree instances simultaneously. | |
| template<typename... Ts> | |
| LockFreeMulti< LockFreeUniqueWriter, Ts... > | multiUniqueWrite (LockFree< Ts > &...vs) |
| Return a callable object for writing to multiple LockFree instances simultaneously. | |
| template<quint64 A, quint64 B> | |
| constexpr MetaFlags< A|B > | operator| (MetaFlags< A >, MetaFlags< B >) |
| Compile-time union of MetaFlags. | |
| template<quint64 A, quint64 B> | |
| constexpr MetaFlags< A &B > | operator& (MetaFlags< A >, MetaFlags< B >) |
| Compile-time intersection of MetaFlags. | |
| template<typename T > | |
| constexpr auto | introspect () |
| Obtain the CMetaClassIntrospector for the metaclass of T. More... | |
| void | displayAllUserMetatypesTypes (QTextStream &out) |
| Display all user metatypes. More... | |
| QString | getAllUserMetatypesTypes (const QString &separator="\n") |
| Get all user metatypes. | |
| QString | className (const QObject *object) |
| Class name as from QMetaObject::className with namespace. | |
| QString | classNameShort (const QObject *object) |
| Class name as from QMetaObject::className without namespace. | |
| size_t | heapSizeOf (const QMetaType &) |
| Q_CC_MSVC. More... | |
| size_t | heapSizeOf (const QMetaObject &objectType) |
| Real heap size of an object. | |
| template<typename T > | |
| void | swap (Optional< T > &a, Optional< T > &b) noexcept(std::is_nothrow_swappable_v< T >) |
| Efficient swap for two Optional objects. | |
| bool | startDetachedWithConsoleWindow (const QString &program, const QStringList &arguments) |
| template<typename T , typename F > | |
| void | doAfter (QFuture< T > future, QObject *context, F &&func) |
| Connect a slot or function to be invoked in the given context when a QFuture is finished. | |
| template<typename F > | |
| void | doAfter (QFuture< void > future, QObject *context, F &&func) |
| Connect a slot or function to be invoked in the given context when a void QFuture is finished. | |
| template<class I , class I2 > | |
| auto | makeRange (I begin, I2 end) -> CRange< I > |
| Returns a CRange constructed from begin and end iterators of deduced types. More... | |
| template<class T > | |
| auto | makeConstRange (const T &container) -> CRange< decltype(container.cbegin())> |
| Returns a const CRange constructed from the cbegin and cend iterators of the given container. | |
| template<class T > | |
| void | makeKeysRange (const T &&container)=delete |
| Keys range for a temporary would be unsafe. | |
| template<class T > | |
| void | makePairsRange (const T &&container)=delete |
| Pairs range for a temporary would be unsafe. | |
| void | registerMetadata () |
| Register all relevant metadata in Misc. | |
| template<typename T , typename U , typename F , typename G > | |
| QMetaObject::Connection | connectOnce (T *sender, F signal, U *receiver, G &&slot, Qt::ConnectionType type=Qt::AutoConnection) |
| Wrapper around QObject::connect which disconnects after the signal has been emitted once. | |
| template<typename T , typename F , typename G > | |
| QMetaObject::Connection | connectOnce (T *sender, F signal, G &&slot) |
| Wrapper around QObject::connect which disconnects after the signal has been emitted once. More... | |
| QStringList | getStackTrace () |
| Returns a stack trace of the current thread of execution as a list of function names. More... | |
| QStringList | getStackTraceAlways () |
| Returns a stack trace of the current thread of execution as a list of function names. | |
| template<class F > | |
| QString | removeChars (const QString &s, F predicate) |
| Return a string with characters removed that match the given predicate. | |
| QString | removeIfInString (const QString &string, const QString &inString) |
| Remove if in string. | |
| QString | removeIfNotInString (const QString &string, const QString &inString) |
| Remove if NOT in string. | |
| QString | removeLineBreakAndTab (const QString &s) |
| Remove line breaks and tabs. | |
| SWIFT_MISC_EXPORT QString | removeDateTimeSeparators (const QString &s) |
| Remove the typical separators such as "-", " ". | |
| template<class F > | |
| bool | containsChar (const QString &s, F predicate) |
| True if any character in the string matches the given predicate. | |
| bool | containsLineBreakOrTab (const QString &s) |
| Contains a line break or tab. | |
| template<class F > | |
| int | indexOfChar (const QString &s, F predicate) |
| Index of first character in the string matching the given predicate, or -1 if not found. | |
| SWIFT_MISC_EXPORT qsizetype | nthIndexOf (const QString &string, QChar ch, int nth=1, Qt::CaseSensitivity cs=Qt::CaseInsensitive) |
| nth index of ch | |
| template<class F > | |
| QList< QStringView > | splitStringRefs (const QString &s, F predicate) |
| Split a string into multiple strings, using a predicate function to identify the split points. More... | |
| SWIFT_MISC_EXPORT QList< QStringView > | splitLinesRefs (const QString &s) |
| Split a string into multiple lines. Blank lines are skipped. More... | |
| template<class F > | |
| void | splitStringRefs (const QString &&, F)=delete |
| It would be risky to call splitStringRefs with an rvalue, so forbid it. | |
| void | splitLinesRefs (const QString &&)=delete |
| It would be risky to call splitLinesRefs with an rvalue, so forbid it. | |
| template<class F > | |
| QStringList | splitString (const QString &s, F predicate) |
| Split a string into multiple strings, using a predicate function to identify the split points. | |
| SWIFT_MISC_EXPORT QStringList | splitLines (const QString &s) |
| Split a string into multiple lines. Blank lines are skipped. | |
| SWIFT_MISC_EXPORT QByteArray | utfToPercentEncoding (const QString &s, const QByteArray &allow={}, char percent='%') |
| Extended percent encoding supporting UTF-16. | |
| SWIFT_MISC_EXPORT QString | utfFromPercentEncoding (const QByteArray &ba, char percent='%') |
| Reverse utfFromPercentEncoding. | |
| template<class K , class V > | |
| QString | qmapToString (const QMap< K, V > &map) |
| A map converted to string. | |
| SWIFT_MISC_EXPORT QMap< QString, QString > | parseIniValues (const QString &data) |
| Obtain ini file like values, e.g. foo=bar. | |
| bool | is09 (const QChar &c) |
| Is 0-9 char, isDigit allows a bunch of more characters. | |
| bool | is09OrSeparator (const QChar &c) |
| Is 0-9, or ","/";". | |
| const QString & | safeAt (const QStringList &stringList, int index) |
| Safe "at" function, returns empty string if index does not exists. | |
| bool | isDigitsOnlyString (const QString &testString) |
| String with digits only. | |
| bool | is09OnlyString (const QString &testString) |
| String with 0-9 only. | |
| bool | is09OrSeparatorOnlyString (const QString &testString) |
| String with 0-9/separator only. | |
| QString | digitOnlyString (const QString &string) |
| String only with digits. | |
| QString | char09OnlyString (const QString &string) |
| String only with 0-9. | |
| QString | char09OrSeparatorOnlyString (const QString &string) |
| String only with 0-9, or separator. | |
| QString | asciiOnlyString (const QString &string) |
| String only with ASCII values. | |
| SWIFT_MISC_EXPORT QString | inApostrophes (const QString &in, bool ignoreEmpty=false) |
| Return string in apostrophes. | |
| SWIFT_MISC_EXPORT QString | inQuotes (const QString &in, bool ignoreEmpty=false) |
| Return string in quotes. | |
| SWIFT_MISC_EXPORT bool | hasBalancedQuotes (const QString &in, char quote='"') |
| Has balanced quotes. | |
| SWIFT_MISC_EXPORT QString | removeSurroundingApostrophes (const QString &in) |
| Remove surrounding apostrophes 'foo' -> foo. | |
| SWIFT_MISC_EXPORT QString | removeSurroundingQuotes (const QString &in) |
| Remove surrounding quotes "foo" -> foo. | |
| SWIFT_MISC_EXPORT const QString & | boolToOnOff (bool v) |
| Bool to on/off. | |
| SWIFT_MISC_EXPORT const QString & | boolToYesNo (bool v) |
| Bool to yes/no. | |
| SWIFT_MISC_EXPORT const QString & | boolToTrueFalse (bool v) |
| Bool to true/false. | |
| SWIFT_MISC_EXPORT const QString & | boolToEnabledDisabled (bool v) |
| Bool to enabled/disabled. | |
| SWIFT_MISC_EXPORT const QString & | boolToNullNotNull (bool isNull) |
| Bool isNull to null/no null. | |
| SWIFT_MISC_EXPORT bool | stringToBool (const QString &boolString) |
| Convert string to bool. | |
| SWIFT_MISC_EXPORT int | fuzzyShortStringComparision (const QString &str1, const QString &str2, Qt::CaseSensitivity cs=Qt::CaseSensitive) |
| Fuzzy compare for short strings (like ICAO designators) More... | |
| SWIFT_MISC_EXPORT QString | intToHex (int value, int digits=2) |
| Int to hex value. | |
| SWIFT_MISC_EXPORT QString | dotToLocaleDecimalPoint (QString &input) |
| Replace dot '.' by locale decimal point. | |
| SWIFT_MISC_EXPORT QString | dotToLocaleDecimalPoint (const QString &input) |
| Replace dot '.' by locale decimal point. | |
| SWIFT_MISC_EXPORT QString | stripDesignatorFromCompleterString (const QString &candidate) |
| Strip a designator from a combined string. | |
| SWIFT_MISC_EXPORT QString | simplifyAccents (const QString &candidate) |
| Remove accents / diacritic marks from a string. | |
| SWIFT_MISC_EXPORT QString | simplifyByDecomposition (const QString &candidate) |
| Remove accents / diacritic marks from a string by doing a Unicode decomposition and removing mark characters. | |
| SWIFT_MISC_EXPORT bool | caseInsensitiveStringCompare (const QString &c1, const QString &c2) |
| Case insensitive string compare. | |
| SWIFT_MISC_EXPORT bool | stringCompare (const QString &c1, const QString &c2, Qt::CaseSensitivity cs) |
| String compare. | |
| SWIFT_MISC_EXPORT QString | simplifyNameForSearch (const QString &name) |
| Get a simplified upper case name for searching by removing all characters except A-Z. | |
| SWIFT_MISC_EXPORT QString | withQuestionMark (const QString &question) |
| Add a question mark at the end if not existing. | |
| SWIFT_MISC_EXPORT QDateTime | fromStringUtc (const QString &dateTimeString, const QString &format) |
| Same as QDateTime::fromString but QDateTime will be set to UTC. More... | |
| SWIFT_MISC_EXPORT QDateTime | fromStringUtc (const QString &dateTimeString, Qt::DateFormat format=Qt::TextDate) |
| Same as QDateTime::fromString but QDateTime will be set to UTC. More... | |
| SWIFT_MISC_EXPORT QDateTime | fromStringUtc (const QString &dateTimeString, const QLocale &locale, QLocale::FormatType format) |
| Same as QDateTime::fromString but QDateTime will be set to UTC. More... | |
| SWIFT_MISC_EXPORT QDateTime | parseMultipleDateTimeFormats (const QString &dateTimeString) |
| Parse multiple date time formats. More... | |
| SWIFT_MISC_EXPORT QDateTime | parseDateTimeStringOptimized (const QString &dateTimeString) |
| Parse yyyyMMddHHmmsszzz strings optimized. More... | |
| SWIFT_MISC_EXPORT QString | joinStringSet (const QSet< QString > &set, const QString &separator) |
| Convert string to bool. | |
| SWIFT_MISC_EXPORT QString | removeComments (const QString &in, bool removeSlash, bool removeDoubleSlash) |
| Remove comments such as /** **/ or //. | |
| SWIFT_MISC_EXPORT bool | containsAny (const QString &testString, const QStringList &any, Qt::CaseSensitivity cs) |
| Contains any string of the list? | |
| SWIFT_MISC_EXPORT double | parseFraction (const QString &fraction, double failDefault=std::numeric_limits< double >::quiet_NaN()) |
| Parse a fraction like 2/3. | |
| SWIFT_MISC_EXPORT QString | cleanNumber (const QString &number) |
| Remove leading 0, trailing 0, " ", and "." from a number. | |
| template<typename F > | |
| auto | singleShot (int msec, QObject *target, F &&task) |
| Starts a single-shot timer which will call a task in the thread of the given object when it times out. More... | |
| SWIFT_MISC_EXPORT void | setMockCacheRootDirectory (const QString &path) |
| Overwrite the default root directory for cache and settings, for testing purposes. More... | |
| template<typename T > | |
| void | registerMetaValueType () |
| This registers the value type T with the swift::misc:: meta type system, making it available for use with the extended feature set of swift::misc::CVariant. More... | |
| template<typename T > | |
| T::const_iterator | begin (const LockFreeReader< T > &reader) |
| Non-member begin() and end() for so LockFree containers can be used in ranged for loops. | |
| template<typename T > | |
| T::const_iterator | end (const LockFreeReader< T > &reader) |
| Non-member begin() and end() for so LockFree containers can be used in ranged for loops. | |
| template<typename T > | |
| T::iterator | begin (const LockFreeUniqueWriter< T > &writer) |
| Non-member begin() and end() for so LockFree containers can be used in ranged for loops. | |
| template<typename T > | |
| T::iterator | end (const LockFreeUniqueWriter< T > &writer) |
| Non-member begin() and end() for so LockFree containers can be used in ranged for loops. | |
| template<typename T > | |
| T::iterator | begin (const LockFreeSharedWriter< T > &writer) |
| Non-member begin() and end() for so LockFree containers can be used in ranged for loops. | |
| template<typename T > | |
| T::iterator | end (const LockFreeSharedWriter< T > &writer) |
| Non-member begin() and end() for so LockFree containers can be used in ranged for loops. | |
| template<typename T > | |
| T::const_iterator | begin (const LockFreeReader< T > &&)=delete |
| Deleted overloads of begin() and end() for rvalue readers and writers. More... | |
| template<typename T > | |
| T::const_iterator | end (const LockFreeReader< T > &&)=delete |
| Deleted overloads of begin() and end() for rvalue readers and writers. More... | |
| template<typename T > | |
| T::iterator | begin (const LockFreeUniqueWriter< T > &&)=delete |
| Deleted overloads of begin() and end() for rvalue readers and writers. More... | |
| template<typename T > | |
| T::iterator | end (const LockFreeUniqueWriter< T > &&)=delete |
| Deleted overloads of begin() and end() for rvalue readers and writers. More... | |
| template<typename T > | |
| T::iterator | begin (const LockFreeSharedWriter< T > &&)=delete |
| Deleted overloads of begin() and end() for rvalue readers and writers. More... | |
| template<typename T > | |
| T::iterator | end (const LockFreeSharedWriter< T > &&)=delete |
| Deleted overloads of begin() and end() for rvalue readers and writers. More... | |
| template<class I > | |
| QDebug | operator<< (QDebug d, const CRange< I > &range) |
| Streaming operators for CRange to qDebug. | |
| template<class I > | |
| QNoDebug | operator<< (QNoDebug d, const CRange< I > &) |
| Streaming operators for CRange to qDebug. | |
| template<class T > | |
| auto | makeRange (T &container) -> CRange< decltype(container.begin())> |
| Returns a CRange constructed from the begin and end iterators of the given container. | |
| template<class T > | |
| auto | makeRange (const T &container) -> CRange< decltype(container.begin())> |
| Returns a CRange constructed from the begin and end iterators of the given container. | |
| template<class T > | |
| auto | makeKeysRange (const T &container) |
| Returns a const CRange for iterating over the keys of a Qt associative container. More... | |
| template<class T > | |
| void | makeKeysRange (T &container) |
| Returns a const CRange for iterating over the keys of a Qt associative container. More... | |
| template<class T > | |
| auto | makePairsRange (const T &container) |
| Returns a const CRange for iterating over the keys and values of a Qt associative container. More... | |
| template<class T > | |
| auto | makePairsRange (T &container) |
| Returns a const CRange for iterating over the keys and values of a Qt associative container. More... | |
Variables | |
| template<typename T > | |
| constexpr bool | THasMetaBaseV = QMetaTypeId<typename TBaseOf<T>::type>::Defined |
| True if T has a member typedef base_type which is a registered metatype. | |
Free functions in swift::misc.
Register metadata.
Base and utility classes available in all other projects.
|
delete |
|
delete |
|
delete |
| QMetaObject::Connection swift::misc::connectOnce | ( | T * | sender, |
| F | signal, | ||
| G && | slot | ||
| ) |
Wrapper around QObject::connect which disconnects after the signal has been emitted once.
| SWIFT_MISC_EXPORT void swift::misc::displayAllUserMetatypesTypes | ( | QTextStream & | out | ) |
Display all user metatypes.
Definition at line 13 of file metadatautils.cpp.
|
delete |
|
delete |
|
delete |
| SWIFT_MISC_EXPORT QDateTime swift::misc::fromStringUtc | ( | const QString & | dateTimeString, |
| const QLocale & | locale, | ||
| QLocale::FormatType | format | ||
| ) |
Same as QDateTime::fromString but QDateTime will be set to UTC.
| SWIFT_MISC_EXPORT QDateTime swift::misc::fromStringUtc | ( | const QString & | dateTimeString, |
| const QString & | format | ||
| ) |
Same as QDateTime::fromString but QDateTime will be set to UTC.
| SWIFT_MISC_EXPORT QDateTime swift::misc::fromStringUtc | ( | const QString & | dateTimeString, |
| Qt::DateFormat | format = Qt::TextDate |
||
| ) |
Same as QDateTime::fromString but QDateTime will be set to UTC.
| SWIFT_MISC_EXPORT int swift::misc::fuzzyShortStringComparision | ( | const QString & | str1, |
| const QString & | str2, | ||
| Qt::CaseSensitivity | cs = Qt::CaseSensitive |
||
| ) |
Fuzzy compare for short strings (like ICAO designators)
| SWIFT_MISC_EXPORT int swift::misc::getProcessCpuTimeMs | ( | ) |
Get the time in milliseconds that the CPU has spent executing the current process.
This is the sum of getThreadCpuTimeMs() for all threads.
Definition at line 61 of file cputime.cpp.
| SWIFT_MISC_EXPORT QStringList swift::misc::getStackTrace | ( | ) |
Returns a stack trace of the current thread of execution as a list of function names.
Returns a dummy list in release build.
Definition at line 39 of file stacktrace.cpp.
| SWIFT_MISC_EXPORT size_t swift::misc::heapSizeOf | ( | const QMetaType & | ) |
| auto swift::misc::makeKeysRange | ( | const T & | container | ) |
| void swift::misc::makeKeysRange | ( | T & | container | ) |
| auto swift::misc::makePairsRange | ( | const T & | container | ) |
Returns a const CRange for iterating over the keys and values of a Qt associative container.
The value_type of the returned range is std::pair<T::key_type &, T::value_type &>.
This is more efficient than using the keys() method of the container and thereafter looking up each key, as it neither allocates memory, nor performs any key lookups.
| auto swift::misc::makePairsRange | ( | T & | container | ) |
Returns a const CRange for iterating over the keys and values of a Qt associative container.
The value_type of the returned range is std::pair<T::key_type &, T::value_type &>.
This is more efficient than using the keys() method of the container and thereafter looking up each key, as it neither allocates memory, nor performs any key lookups.
| auto swift::misc::makeRange | ( | I | begin, |
| I2 | end | ||
| ) | -> CRange<I> |
| SWIFT_MISC_EXPORT QDateTime swift::misc::parseDateTimeStringOptimized | ( | const QString & | dateTimeString | ) |
Parse yyyyMMddHHmmsszzz strings optimized.
| SWIFT_MISC_EXPORT QDateTime swift::misc::parseMultipleDateTimeFormats | ( | const QString & | dateTimeString | ) |
Parse multiple date time formats.
| void swift::misc::registerMetaValueType | ( | ) |
This registers the value type T with the swift::misc:: meta type system, making it available for use with the extended feature set of swift::misc::CVariant.
The implementation (ab)uses the QMetaType converter function registration mechanism to store a type-erased representation of the set of operations supported by T.
| auto swift::misc::removeIfIn | ( | I | begin1, |
| I | end1, | ||
| J | begin2, | ||
| J | end2 | ||
| ) |
Removes those elements in range 1 that appear also in range 2 leaving only those that do not appear in range 2.
Returns an iterator one past the new end of range 1.
Definition at line 25 of file algorithm.h.
| SWIFT_MISC_EXPORT void swift::misc::setMockCacheRootDirectory | ( | const QString & | path | ) |
Overwrite the default root directory for cache and settings, for testing purposes.
May not be called after any cache or settings objects have been constructed.
| auto swift::misc::singleShot | ( | int | msec, |
| QObject * | target, | ||
| F && | task | ||
| ) |
Starts a single-shot timer which will call a task in the thread of the given object when it times out.
Differs from QTimer::singleShot in that this implementation interacts better with QObject::moveToThread, and returns a QFuture which can be used to detect when the task has finished or obtain its return value.
Definition at line 30 of file threadutils.h.
| SWIFT_MISC_EXPORT QList<QStringView> swift::misc::splitLinesRefs | ( | const QString & | s | ) |
Split a string into multiple lines. Blank lines are skipped.
| QList<QStringView> swift::misc::splitStringRefs | ( | const QString & | s, |
| F | predicate | ||
| ) |
Split a string into multiple strings, using a predicate function to identify the split points.
Definition at line 91 of file stringutils.h.
| bool swift::misc::startDetachedWithConsoleWindow | ( | const QString & | program, |
| const QStringList & | arguments | ||
| ) |
Definition at line 59 of file processctrl.cpp.
| void swift::misc::topologicallySortedInsert | ( | C & | container, |
| T && | value, | ||
| F | comparator | ||
| ) |
Insert an element into a sequential container while preserving the topological ordering of the container.
| container | A sequential container. |
| value | The value to insert. |
| comparator | A binary function which defines a less-than relation between elements of the container. The ordering it induces must be a partial ordering, which is a more relaxed requirement than the strict weak ordering required by most standard sorting algorithms. |
Definition at line 142 of file algorithm.h.
| void swift::misc::topologicalSort | ( | I | begin, |
| I | end, | ||
| F | comparator | ||
| ) |
Topological sorting algorithm.
| begin | Begin iterator of the range to sort. |
| end | End iterator of the range to sort. |
| comparator | A binary function which defines a less-than relation between elements of the range. The ordering it induces must be a partial ordering, which is a more relaxed requirement than the strict weak ordering required by most standard sorting algorithms. |
Definition at line 114 of file algorithm.h.