mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 10:12:45 +00:00 
			
		
		
		
	AK: Add outln_if and warnln_if
This uses the same gating mechanism as dbgln_if and should be equivalent to #define flag etc
This commit is contained in:
		
							parent
							
								
									2976311536
								
							
						
					
					
						commit
						2e11b2d35a
					
				
					 1 changed files with 17 additions and 1 deletions
				
			
		
							
								
								
									
										18
									
								
								AK/Format.h
									
										
									
									
									
								
							
							
						
						
									
										18
									
								
								AK/Format.h
									
										
									
									
									
								
							|  | @ -384,13 +384,29 @@ void outln(CheckedFormatString<Parameters...>&& fmtstr, const Parameters&... par | |||
| 
 | ||||
| inline void outln() { outln(stdout); } | ||||
| 
 | ||||
| #    define outln_if(flag, fmt, ...)       \ | ||||
|         do {                               \ | ||||
|             if constexpr (flag)            \ | ||||
|                 outln(fmt, ##__VA_ARGS__); \ | ||||
|         } while (0) | ||||
| 
 | ||||
| template<typename... Parameters> | ||||
| void warn(CheckedFormatString<Parameters...>&& fmtstr, const Parameters&... parameters) { out(stderr, move(fmtstr), parameters...); } | ||||
| void warn(CheckedFormatString<Parameters...>&& fmtstr, const Parameters&... parameters) | ||||
| { | ||||
|     out(stderr, move(fmtstr), parameters...); | ||||
| } | ||||
| 
 | ||||
| template<typename... Parameters> | ||||
| void warnln(CheckedFormatString<Parameters...>&& fmtstr, const Parameters&... parameters) { outln(stderr, move(fmtstr), parameters...); } | ||||
| 
 | ||||
| inline void warnln() { outln(stderr); } | ||||
| 
 | ||||
| #    define warnln_if(flag, fmt, ...)      \ | ||||
|         do {                               \ | ||||
|             if constexpr (flag)            \ | ||||
|                 outln(fmt, ##__VA_ARGS__); \ | ||||
|         } while (0) | ||||
| 
 | ||||
| #endif | ||||
| 
 | ||||
| void vdbgln(StringView fmtstr, TypeErasedFormatParams); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Hendiadyoin1
						Hendiadyoin1