qt5base-lts/util/lexgen/global.h
Lucie Gérard 05fc3aef53 Use SPDX license identifiers
Replace the current license disclaimer in files by
a SPDX-License-Identifier.
Files that have to be modified by hand are modified.
License files are organized under LICENSES directory.

Task-number: QTBUG-67283
Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-05-16 16:37:38 +02:00

76 lines
1.5 KiB
C

// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef GLOBAL_H
#define GLOBAL_H
#include <QHash>
#include <QDataStream>
#include <QSet>
#include "configfile.h"
#if 1
typedef int InputType;
enum SpecialInputType {
DigitInput,
SpaceInput,
Letter
};
#else
enum SpecialInputType {
NoSpecialInput = 0,
DigitInput,
SpaceInput,
LetterOrNumberInput
};
struct InputType
{
inline InputType() : val(0), specialInput(NoSpecialInput) {}
inline InputType(const int &val) : val(val), specialInput(NoSpecialInput) {}
inline operator int() const { return val; }
inline bool operator==(const InputType &other) const
{ return val == other.val; }
inline bool operator!=(const InputType &other) const
{ return val != other.val; }
int val;
SpecialInputType specialInput;
};
inline int qHash(const InputType &t) { return qHash(t.val); }
inline QDataStream &operator<<(QDataStream &stream, const InputType &i)
{
return stream << i;
}
inline QDataStream &operator>>(QDataStream &stream, InputType &i)
{
return stream >> i;
}
#endif
const InputType Epsilon = -1;
struct Config
{
inline Config() : caseSensitivity(Qt::CaseSensitive), debug(false), cache(false) {}
QSet<InputType> maxInputSet;
Qt::CaseSensitivity caseSensitivity;
QString className;
bool debug;
bool cache;
QString ruleFile;
ConfigFile::SectionMap configSections;
};
#endif // GLOBAL_H