1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:38:11 +00:00

Userland: Change typedef to using directive

Problem:
- `typedef`s are read backwards making it confusing.
- `using` statements can be used in template aliases.
- `using` provides similarity to most other C++ syntax.

- C++ core guidelines say to prefer `using` over `typedef`:
  https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rt-using

Solution:
- Switch these where appropriate.
This commit is contained in:
Lenny Maiorani 2021-05-20 17:27:29 -06:00 committed by Linus Groh
parent 800ea8ea96
commit 68f76b9e37
6 changed files with 6 additions and 7 deletions

View file

@ -13,7 +13,7 @@
#include <AK/SinglyLinkedList.h> #include <AK/SinglyLinkedList.h>
#include <LibAudio/Buffer.h> #include <LibAudio/Buffer.h>
typedef AK::SinglyLinkedListIterator<SinglyLinkedList<RollNote>, RollNote> RollIter; using RollIter = AK::SinglyLinkedListIterator<SinglyLinkedList<RollNote>, RollNote>;
class Track { class Track {
AK_MAKE_NONCOPYABLE(Track); AK_MAKE_NONCOPYABLE(Track);

View file

@ -17,6 +17,5 @@ enum class BreakpointChange {
Removed, Removed,
}; };
typedef Function<void(const String& file, size_t line, BreakpointChange)> BreakpointChangeCallback; using BreakpointChangeCallback = Function<void(const String& file, size_t line, BreakpointChange)>;
} }

View file

@ -13,7 +13,7 @@
namespace HackStudio { namespace HackStudio {
// A "GitFileAction" is either the staging or the unstaging of a file. // A "GitFileAction" is either the staging or the unstaging of a file.
typedef Function<void(const LexicalPath& file)> GitFileActionCallback; using GitFileActionCallback = Function<void(const LexicalPath& file)>;
class GitFilesView : public GUI::ListView { class GitFilesView : public GUI::ListView {
C_OBJECT(GitFilesView) C_OBJECT(GitFilesView)

View file

@ -14,7 +14,7 @@
namespace HackStudio { namespace HackStudio {
typedef Function<void(const String& original_content, const String& diff)> ViewDiffCallback; using ViewDiffCallback = Function<void(const String& original_content, const String& diff)>;
class GitWidget final : public GUI::Widget { class GitWidget final : public GUI::Widget {
C_OBJECT(GitWidget) C_OBJECT(GitWidget)

View file

@ -332,7 +332,7 @@ public:
generator.append(R"~~~( generator.append(R"~~~(
}; // end Action }; // end Action
typedef Function<void(Action, u8)> Handler; using Handler = Function<void(Action, u8)>;
@class_name@(Handler handler) @class_name@(Handler handler)
: m_handler(move(handler)) : m_handler(move(handler))

View file

@ -25,7 +25,7 @@
// An NtpTimestamp is a 64-bit integer that's a 32.32 binary-fixed point number. // An NtpTimestamp is a 64-bit integer that's a 32.32 binary-fixed point number.
// The integral part in the upper 32 bits represents seconds since 1900-01-01. // The integral part in the upper 32 bits represents seconds since 1900-01-01.
// The fractional part in the lower 32 bits stores fractional bits times 2 ** 32. // The fractional part in the lower 32 bits stores fractional bits times 2 ** 32.
typedef uint64_t NtpTimestamp; using NtpTimestamp = uint64_t;
struct [[gnu::packed]] NtpPacket { struct [[gnu::packed]] NtpPacket {
uint8_t li_vn_mode; uint8_t li_vn_mode;