mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 21:52:45 +00:00 
			
		
		
		
	AK: Handle LogStream operator<<(size_t)
This has been an annoyingly missing feature for some time.
This commit is contained in:
		
							parent
							
								
									91fc6a056b
								
							
						
					
					
						commit
						1726c17d0d
					
				
					 2 changed files with 22 additions and 4 deletions
				
			
		|  | @ -16,12 +16,17 @@ const LogStream& operator<<(const LogStream& stream, const StringView& value) | ||||||
|     return stream; |     return stream; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| const LogStream& operator<<(const LogStream& stream, int value) | const LogStream& operator<<(const LogStream& stream, i32 value) | ||||||
| { | { | ||||||
|     return stream << String::number(value); |     return stream << String::number(value); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| const LogStream& operator<<(const LogStream& stream, unsigned value) | const LogStream& operator<<(const LogStream& stream, u32 value) | ||||||
|  | { | ||||||
|  |     return stream << String::number(value); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | const LogStream& operator<<(const LogStream& stream, u64 value) | ||||||
| { | { | ||||||
|     return stream << String::number(value); |     return stream << String::number(value); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -1,5 +1,6 @@ | ||||||
| #pragma once | #pragma once | ||||||
| 
 | 
 | ||||||
|  | #include <AK/Types.h> | ||||||
| #include <AK/kstdio.h> | #include <AK/kstdio.h> | ||||||
| 
 | 
 | ||||||
| #ifdef USERLAND | #ifdef USERLAND | ||||||
|  | @ -59,8 +60,20 @@ inline const LogStream& operator<<(const LogStream& stream, const char* value) | ||||||
| 
 | 
 | ||||||
| const LogStream& operator<<(const LogStream&, const String&); | const LogStream& operator<<(const LogStream&, const String&); | ||||||
| const LogStream& operator<<(const LogStream&, const StringView&); | const LogStream& operator<<(const LogStream&, const StringView&); | ||||||
| const LogStream& operator<<(const LogStream&, int); | const LogStream& operator<<(const LogStream&, i32); | ||||||
| const LogStream& operator<<(const LogStream&, unsigned); | const LogStream& operator<<(const LogStream&, u32); | ||||||
|  | const LogStream& operator<<(const LogStream&, u64); | ||||||
|  | 
 | ||||||
|  | #ifdef __serenity__ | ||||||
|  | inline const LogStream& operator<<(const LogStream& stream, size_t value) | ||||||
|  | { | ||||||
|  |     if constexpr (sizeof(size_t) == 4) | ||||||
|  |         return stream << (u32)value; | ||||||
|  |     else | ||||||
|  |         return stream << (u64)value; | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
| const LogStream& operator<<(const LogStream&, const void*); | const LogStream& operator<<(const LogStream&, const void*); | ||||||
| 
 | 
 | ||||||
| inline const LogStream& operator<<(const LogStream& stream, char value) | inline const LogStream& operator<<(const LogStream& stream, char value) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling