File indexing completed on 2025-02-09 04:28:37

0001 /*
0002   This file is part of the KTextTemplate library
0003 
0004   SPDX-FileCopyrightText: 2010 Stephen Kelly <steveire@gmail.com>
0005 
0006   SPDX-License-Identifier: LGPL-2.1-or-later
0007 
0008 */
0009 
0010 #ifndef KTEXTTEMPLATE_METAENUMVARIABLE_P_H
0011 #define KTEXTTEMPLATE_METAENUMVARIABLE_P_H
0012 
0013 #include <QMetaEnum>
0014 
0015 struct MetaEnumVariable {
0016     MetaEnumVariable()
0017         : value(-1)
0018     {
0019     }
0020 
0021     MetaEnumVariable(QMetaEnum _enumerator)
0022         : enumerator(_enumerator)
0023         , value(-1)
0024     {
0025     }
0026 
0027     MetaEnumVariable(QMetaEnum _enumerator, int _value)
0028         : enumerator(_enumerator)
0029         , value(_value)
0030     {
0031     }
0032 
0033     bool operator==(const MetaEnumVariable &other) const
0034     {
0035         return (enumerator.scope() == other.enumerator.scope() && enumerator.name() == other.enumerator.name()) && value == other.value;
0036     }
0037 
0038     bool operator==(int otherValue) const
0039     {
0040         return value == otherValue;
0041     }
0042 
0043     bool operator<(const MetaEnumVariable &other) const
0044     {
0045         return value < other.value;
0046     }
0047 
0048     bool operator<(int otherValue) const
0049     {
0050         return value < otherValue;
0051     }
0052 
0053     QMetaEnum enumerator;
0054     int value;
0055 };
0056 
0057 Q_DECLARE_METATYPE(MetaEnumVariable)
0058 
0059 #endif