File indexing completed on 2024-04-28 05:38:43

0001 
0002 // Enum is too small, won't be checked
0003 enum TooSmall {
0004     FooTooSmall = 1,            // Ok
0005     BarTooSmall = 2,            // Ok
0006     LalaTooSmall = 4,            // Ok
0007 };
0008 
0009 
0010 enum TEST_FLAGS {
0011     Foo = 1,            // Ok
0012     Bar = 2,            // Ok
0013     Both = Foo | Bar,   // OK
0014     Something = 3       // Warn
0015 };
0016 
0017 // Copied from Qt for testing purposes
0018 enum AlignmentFlag {
0019     AlignLeft = 0x0001,
0020     AlignLeading = AlignLeft,
0021     AlignRight = 0x0002,
0022     AlignTrailing = AlignRight,
0023     AlignHCenter = 0x0004,
0024     AlignJustify = 0x0008,
0025     AlignAbsolute = 0x0011, // Warn
0026     AlignHorizontal_Mask = AlignLeft | AlignRight | AlignHCenter | AlignJustify | AlignAbsolute,
0027 
0028     AlignTop = 0x0020,
0029     AlignBottom = 0x0040,
0030     AlignVCenter = 0x0080,
0031     AlignBaseline = 0x0100,
0032     // Note that 0x100 will clash with Qt::TextSingleLine = 0x100 due to what the comment above
0033     // this enum declaration states. However, since Qt::AlignBaseline is only used by layouts,
0034     // it doesn't make sense to pass Qt::AlignBaseline to QPainter::drawText(), so there
0035     // shouldn't really be any ambiguity between the two overlapping enum values.
0036     AlignVertical_Mask = AlignTop | AlignBottom | AlignVCenter | AlignBaseline,
0037 
0038     AlignCenter = AlignVCenter | AlignHCenter
0039 };
0040 
0041 // No Warning here, all consecutive values
0042 enum Consecutive {
0043     RED = 1,
0044     GREEN = 2,
0045     BLUE = 3,
0046     BLACK = 4,
0047     WHITE = 5,
0048 };
0049 
0050 #include <QtCore/qtypeinfo.h>
0051 
0052 class FooBar {
0053     public:
0054         int m = 0;
0055 };
0056 Q_DECLARE_TYPEINFO(FooBar, Q_RELOCATABLE_TYPE);
0057 
0058 enum WithMasks
0059 {
0060     V1 = 1,
0061     V2 = 2,
0062     V4 = 4,
0063     V8 = 8,
0064     Mask = 0x0000FFFF
0065 };
0066 
0067 enum RelationFlag {
0068     Label         = 0x00000001,
0069     Labelled      = 0x00000002,
0070     Controller    = 0x00000004,
0071     Controlled    = 0x00000008,
0072     AllRelations  = 0xffffffff
0073 };
0074 
0075 enum class WithZero {
0076     Zero = 0,
0077     Foo = 1,
0078     Bar = 2,
0079     Four = 4,
0080     Eight = 8,
0081 };
0082 
0083 enum class AlsoConsecutive {
0084     RED = 1,
0085     GREEN = 2,
0086     BLUE = 3,
0087     BLACK = 4,
0088     WHITE = 5,
0089     LAST = WHITE
0090 };
0091 
0092 enum class WithNegative
0093 {
0094     V1 = 1,
0095     V2 = 2,
0096     V4 = 4,
0097     V8 = 8,
0098     VFoo = -1
0099 };
0100 
0101 enum Filter {
0102     Dirs        = 0x001,
0103     Files       = 0x002,
0104     Drives      = 0x004,
0105     NoSymLinks  = 0x008,
0106     AllEntries  = Dirs | Files | Drives,// Because of this -1, the type of this enum becomes signed and hence BinaryOp | doesn't need any implicit casts
0107     TypeMask    = 0x00f,
0108 
0109     NoFilter = -1
0110 };
0111 
0112 enum ComponentFormattingOption : unsigned int {
0113     PrettyDecoded = 0x000000,
0114     EncodeSpaces = 0x100000,
0115     EncodeUnicode = 0x200000,
0116     EncodeDelimiters = 0x400000 | 0x800000,
0117     EncodeReserved = 0x1000000,
0118     DecodeReserved = 0x2000000,
0119     // 0x4000000 used to indicate full-decode mode
0120 
0121     FullyEncoded = EncodeSpaces | EncodeUnicode | EncodeDelimiters | EncodeReserved,
0122     FullyDecoded = FullyEncoded | DecodeReserved | 0x4000000
0123 };
0124 enum MarkdownFeature {
0125     MarkdownNoHTML = 0x0020 | 0x0040,
0126     MarkdownDialectCommonMark = 0,
0127     MarkdownDialectGitHub = 0x0004 | 0x0008 | 0x0400 | 0x0100 | 0x0200 | 0x0800 | 0x4000
0128 };
0129 enum Feature {
0130     FeatureCollapseWhitespace =       0x0001,
0131     FeaturePermissiveATXHeaders =     0x0002,
0132     FeaturePermissiveURLAutoLinks =   0x0004,
0133     FeaturePermissiveMailAutoLinks =  0x0008,
0134     FeatureNoIndentedCodeBlocks =     0x0010,
0135     FeatureNoHTMLBlocks =             0x0020,
0136     FeatureNoHTMLSpans =              0x0040,
0137     FeatureTables =                   0x0100,
0138     FeatureStrikeThrough =            0x0200,
0139     FeaturePermissiveWWWAutoLinks =   0x0400,
0140     FeatureTasklists =                0x0800,
0141     FeatureUnderline =                0x4000,
0142     DialectGitHub =                   MarkdownDialectGitHub
0143 };
0144 
0145 
0146 enum class EnumFoo { // OK
0147     A,
0148     B = A,
0149     C,
0150     D,
0151     E,
0152     F
0153 };
0154 
0155 enum class EnumFoo2 { // OK
0156     A = 0,
0157     B = 1,
0158     C = 2,
0159     D = 4,
0160     E = (C | D)
0161 };