mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 08:32:43 +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:
		
							parent
							
								
									800ea8ea96
								
							
						
					
					
						commit
						68f76b9e37
					
				
					 6 changed files with 6 additions and 7 deletions
				
			
		|  | @ -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); | ||||||
|  |  | ||||||
|  | @ -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)>; | ||||||
| 
 |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -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) | ||||||
|  |  | ||||||
|  | @ -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) | ||||||
|  |  | ||||||
|  | @ -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)) | ||||||
|  |  | ||||||
|  | @ -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; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Lenny Maiorani
						Lenny Maiorani