Use 'using' instead of 'typedef'.

This commit is contained in:
Roman Telezhynskyi 2024-02-19 18:26:49 +02:00
parent a48977c1df
commit 2134f969a0
7 changed files with 59 additions and 59 deletions

View File

@ -141,7 +141,7 @@ protected:
/**
* @brief Typedef for the token reader.
*/
typedef QmuParserTokenReader token_reader_type;
using token_reader_type = QmuParserTokenReader;
QLocale m_locale; ///< The locale used by the parser
QChar m_decimalPoint;
@ -202,22 +202,22 @@ private:
* the function pointer to the parser function depending on
* which state it is in. (i.e. bytecode parser vs. string parser)
*/
typedef qreal (QmuParserBase::*ParseFunction)() const;
using ParseFunction = qreal (QmuParserBase::*)() const;
/**
* @brief Type used for storing an array of values.
*/
typedef QVector<qreal> valbuf_type;
using valbuf_type = QVector<qreal>;
/**
* @brief Type for a vector of strings.
*/
typedef QVector<QString> stringbuf_type;
using stringbuf_type = QVector<QString>;
/**
* @brief Type used for parser tokens.
*/
typedef QmuParserToken<qreal, QString> token_type;
using token_type = QmuParserToken<qreal, QString>;
/**
* @brief Maximum number of threads spawned by OpenMP when using the bulk mode.

View File

@ -189,117 +189,117 @@ enum EOprtPrecedence
Depends on wether UNICODE is used or not.
*/
typedef QMUP_STRING_TYPE string_type;
using string_type = std::wstring;
/** @brief The character type used by the parser.
Depends on wether UNICODE is used or not.
*/
typedef string_type::value_type char_type;
using char_type = string_type::value_type;
/** @brief Typedef for easily using stringstream that respect the parser stringtype. */
typedef std::basic_stringstream<char_type, std::char_traits<char_type>, std::allocator<char_type>> stringstream_type;
using stringstream_type = std::basic_stringstream<char_type, std::char_traits<char_type>, std::allocator<char_type>>;
// Data container types
/** @brief Type used for storing variables. */
typedef std::map<QString, qreal *> varmap_type;
using varmap_type = std::map<QString, qreal *>;
/** @brief Type used for storing constants. */
typedef std::map<QString, qreal> valmap_type;
using valmap_type = std::map<QString, qreal>;
/** @brief Type for assigning a string name to an index in the internal string table. */
typedef std::map<QString, qmusizetype> strmap_type;
using strmap_type = std::map<QString, qmusizetype>;
// Parser callbacks
/** @brief Callback type used for functions without arguments. */
typedef qreal (*generic_fun_type)();
using generic_fun_type = qreal (*)();
/** @brief Callback type used for functions without arguments. */
typedef qreal (*fun_type0)();
using fun_type0 = qreal (*)();
/** @brief Callback type used for functions with a single arguments. */
typedef qreal (*fun_type1)(qreal);
using fun_type1 = qreal (*)(qreal);
/** @brief Callback type used for functions with two arguments. */
typedef qreal (*fun_type2)(qreal, qreal);
using fun_type2 = qreal (*)(qreal, qreal);
/** @brief Callback type used for functions with three arguments. */
typedef qreal (*fun_type3)(qreal, qreal, qreal);
using fun_type3 = qreal (*)(qreal, qreal, qreal);
/** @brief Callback type used for functions with four arguments. */
typedef qreal (*fun_type4)(qreal, qreal, qreal, qreal);
using fun_type4 = qreal (*)(qreal, qreal, qreal, qreal);
/** @brief Callback type used for functions with five arguments. */
typedef qreal (*fun_type5)(qreal, qreal, qreal, qreal, qreal);
using fun_type5 = qreal (*)(qreal, qreal, qreal, qreal, qreal);
/** @brief Callback type used for functions with five arguments. */
typedef qreal (*fun_type6)(qreal, qreal, qreal, qreal, qreal, qreal);
using fun_type6 = qreal (*)(qreal, qreal, qreal, qreal, qreal, qreal);
/** @brief Callback type used for functions with five arguments. */
typedef qreal (*fun_type7)(qreal, qreal, qreal, qreal, qreal, qreal, qreal);
using fun_type7 = qreal (*)(qreal, qreal, qreal, qreal, qreal, qreal, qreal);
/** @brief Callback type used for functions with five arguments. */
typedef qreal (*fun_type8)(qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal);
using fun_type8 = qreal (*)(qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal);
/** @brief Callback type used for functions with five arguments. */
typedef qreal (*fun_type9)(qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal);
using fun_type9 = qreal (*)(qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal);
/** @brief Callback type used for functions with five arguments. */
typedef qreal (*fun_type10)(qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal);
using fun_type10 = qreal (*)(qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal);
/** @brief Callback type used for functions without arguments. */
typedef qreal (*bulkfun_type0)(int, int);
using bulkfun_type0 = qreal (*)(int, int);
/** @brief Callback type used for functions with a single arguments. */
typedef qreal (*bulkfun_type1)(int, int, qreal);
using bulkfun_type1 = qreal (*)(int, int, qreal);
/** @brief Callback type used for functions with two arguments. */
typedef qreal (*bulkfun_type2)(int, int, qreal, qreal);
using bulkfun_type2 = qreal (*)(int, int, qreal, qreal);
/** @brief Callback type used for functions with three arguments. */
typedef qreal (*bulkfun_type3)(int, int, qreal, qreal, qreal);
using bulkfun_type3 = qreal (*)(int, int, qreal, qreal, qreal);
/** @brief Callback type used for functions with four arguments. */
typedef qreal (*bulkfun_type4)(int, int, qreal, qreal, qreal, qreal);
using bulkfun_type4 = qreal (*)(int, int, qreal, qreal, qreal, qreal);
/** @brief Callback type used for functions with five arguments. */
typedef qreal (*bulkfun_type5)(int, int, qreal, qreal, qreal, qreal, qreal);
using bulkfun_type5 = qreal (*)(int, int, qreal, qreal, qreal, qreal, qreal);
/** @brief Callback type used for functions with five arguments. */
typedef qreal (*bulkfun_type6)(int, int, qreal, qreal, qreal, qreal, qreal, qreal);
using bulkfun_type6 = qreal (*)(int, int, qreal, qreal, qreal, qreal, qreal, qreal);
/** @brief Callback type used for functions with five arguments. */
typedef qreal (*bulkfun_type7)(int, int, qreal, qreal, qreal, qreal, qreal, qreal, qreal);
using bulkfun_type7 = qreal (*)(int, int, qreal, qreal, qreal, qreal, qreal, qreal, qreal);
/** @brief Callback type used for functions with five arguments. */
typedef qreal (*bulkfun_type8)(int, int, qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal);
using bulkfun_type8 = qreal (*)(int, int, qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal);
/** @brief Callback type used for functions with five arguments. */
typedef qreal (*bulkfun_type9)(int, int, qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal);
using bulkfun_type9 = qreal (*)(int, int, qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal);
/** @brief Callback type used for functions with five arguments. */
typedef qreal (*bulkfun_type10)(int, int, qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal);
using bulkfun_type10 = qreal (*)(int, int, qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal);
/** @brief Callback type used for functions with a variable argument list. */
typedef qreal (*multfun_type)(const qreal *, qmusizetype);
using multfun_type = qreal (*)(const qreal *, qmusizetype);
/** @brief Callback type used for functions taking a string as an argument. */
typedef qreal (*strfun_type1)(const QString &);
using strfun_type1 = qreal (*)(const QString &);
/** @brief Callback type used for functions taking a string and a value as arguments. */
typedef qreal (*strfun_type2)(const QString &, qreal);
using strfun_type2 = qreal (*)(const QString &, qreal);
/** @brief Callback type used for functions taking a string and two values as arguments. */
typedef qreal (*strfun_type3)(const QString &, qreal, qreal);
using strfun_type3 = qreal (*)(const QString &, qreal, qreal);
/** @brief Callback used for functions that identify values in a string. */
typedef int (*identfun_type)(const QString &sExpr, qmusizetype *nPos, qreal *fVal, const QLocale &locale, bool cNumbers,
const QChar &decimal, const QChar &thousand);
using identfun_type = int (*)(const QString &, qmusizetype *, qreal *, const QLocale &, bool, const QChar &,
const QChar &);
/** @brief Callback used for variable creation factory functions. */
typedef qreal *(*facfun_type)(const QString &, void *);
using facfun_type = qreal *(*)(const QString &, void *);
} // namespace qmu
#endif

View File

@ -59,7 +59,7 @@ class QMUPARSERSHARED_EXPORT QmuParserTester : public QObject // final
Q_OBJECT // NOLINT
public:
typedef int (QmuParserTester::*testfun_type)();
using testfun_type = int (QmuParserTester::*)();
explicit QmuParserTester(QObject *parent = nullptr);

View File

@ -65,19 +65,19 @@
Class &operator=(Class &&) = delete;
#endif
typedef signed char dint8; /* 8 bit signed */
typedef signed short dint16; /* 16 bit signed */
typedef signed int dint32; /* 32 bit signed */
typedef long long int dint64; /* 64 bit signed */
using dint8 = signed char; /* 8 bit signed */
using dint16 = short; /* 16 bit signed */
using dint32 = int; /* 32 bit signed */
using dint64 = long long; /* 64 bit signed */
typedef unsigned char duint8; /* 8 bit unsigned */
typedef unsigned short duint16; /* 16 bit unsigned */
typedef unsigned int duint32; /* 32 bit unsigned */
typedef unsigned long long int duint64; /* 64 bit unsigned */
using duint8 = unsigned char; /* 8 bit unsigned */
using duint16 = unsigned short; /* 16 bit unsigned */
using duint32 = unsigned int; /* 32 bit unsigned */
using duint64 = unsigned long long; /* 64 bit unsigned */
typedef float dfloat32; /* 32 bit floating point */
typedef double ddouble64; /* 64 bit floating point */
typedef long double ddouble80; /* 80 bit floating point */
using dfloat32 = float; /* 32 bit floating point */
using ddouble64 = double; /* 64 bit floating point */
using ddouble80 = long double; /* 80 bit floating point */
namespace DRW
{
@ -493,13 +493,13 @@ public:
}
private:
typedef union
using DRW_VarContent = union
{
UTF8STRING *s;
dint32 i;
double d;
DRW_Coord *v;
} DRW_VarContent;
};
public:
DRW_VarContent content;

View File

@ -66,8 +66,8 @@ public:
static void InitTileTemplates(QComboBox *comboBoxTemplates, bool keepCustom = false);
protected:
typedef QStringList FormatsVector;
typedef int VIndexType;
using FormatsVector = QStringList;
using VIndexType = int;
static auto PageFormatNames() -> const FormatsVector &;
static auto RoundTemplateSize(qreal width, qreal height, Unit unit) -> QSizeF;

View File

@ -219,7 +219,7 @@ enum class PiecePathType : quint8
Unknown = 3
};
typedef int ToolVisHolderType;
using ToolVisHolderType = int;
enum class Tool : ToolVisHolderType
{
Arrow,

View File

@ -39,7 +39,7 @@
using namespace Qt::Literals::StringLiterals;
typedef QPair<bool, VPieceNode> UnitedPathNode;
using UnitedPathNode = QPair<bool, VPieceNode>;
Q_DECLARE_METATYPE(UnitedPathNode)