// SPDX-FileCopyrightText: Copyright (C) 2014 swift Project Community / Contributors // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1 //! \file #ifndef SWIFT_MISC_VARIANTLIST_H #define SWIFT_MISC_VARIANTLIST_H #include #include #include #include "misc/collection.h" #include "misc/sequence.h" #include "misc/swiftmiscexport.h" #include "misc/variant.h" SWIFT_DECLARE_SEQUENCE_MIXINS(swift::misc, CVariant, CVariantList) namespace swift::misc { /*! * Value object encapsulating a list of variants. * * A CVariant containing any registered sequential container type can be converted to a CVariantList. */ class SWIFT_MISC_EXPORT CVariantList : public CSequence, public swift::misc::mixin::MetaType { public: SWIFT_MISC_DECLARE_USING_MIXIN_METATYPE(CVariantList) using CSequence::CSequence; //! Default constructor. CVariantList() {} //! Construct from a base class object. CVariantList(const CSequence &other); //! Construct from a QVariantList. CVariantList(const QVariantList &other); //! Construct from a moved QVariantList. CVariantList(QVariantList &&other); //! Convert to a sequence type by converting all elements. template T to() const { return CVariant::from(*this).template to(); } //! Convert from a sequence type by converting all elements. template static CVariantList from(const T &list) { return CVariant::from(list).template to(); } //! \copydoc swift::misc::CValueObject::registerMetadata static void registerMetadata(); //! True if any element of the list matches the given event. bool matches(const CVariant &event) const; }; } // namespace swift::misc Q_DECLARE_METATYPE(swift::misc::CVariantList) Q_DECLARE_METATYPE(swift::misc::CCollection) #endif