mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 06:02:44 +00:00 
			
		
		
		
	LibCore: Add new REGISTER_STRING_PROPERTY macro
This commit is contained in:
		
							parent
							
								
									ee5838084d
								
							
						
					
					
						commit
						858e55b653
					
				
					 2 changed files with 11 additions and 8 deletions
				
			
		|  | @ -295,6 +295,16 @@ requires IsBaseOf<Object, T> | |||
|             return true;                                      \ | ||||
|         }); | ||||
| 
 | ||||
| // FIXME: Port JsonValue to the new String class.
 | ||||
| #define REGISTER_STRING_PROPERTY(property_name, getter, setter)                                                                           \ | ||||
|     register_property(                                                                                                                    \ | ||||
|         property_name,                                                                                                                    \ | ||||
|         [this]() { return this->getter().to_deprecated_string(); },                                                                       \ | ||||
|         [this](auto& value) {                                                                                                             \ | ||||
|             this->setter(String::from_deprecated_string(value.to_deprecated_string()).release_value_but_fixme_should_propagate_errors()); \ | ||||
|             return true;                                                                                                                  \ | ||||
|         }); | ||||
| 
 | ||||
| #define REGISTER_DEPRECATED_STRING_PROPERTY(property_name, getter, setter) \ | ||||
|     register_property(                                                     \ | ||||
|         property_name,                                                     \ | ||||
|  |  | |||
|  | @ -28,14 +28,7 @@ AbstractButton::AbstractButton(String text) | |||
|         click(); | ||||
|     }; | ||||
| 
 | ||||
|     // FIXME: Port JsonValue to the new String class.
 | ||||
|     register_property( | ||||
|         "text", | ||||
|         [this]() { return this->text().to_deprecated_string(); }, | ||||
|         [this](auto& value) { | ||||
|             this->set_text(String::from_deprecated_string(value.to_deprecated_string()).release_value_but_fixme_should_propagate_errors()); | ||||
|             return true; | ||||
|         }); | ||||
|     REGISTER_STRING_PROPERTY("text", text, set_text); | ||||
|     REGISTER_BOOL_PROPERTY("checked", is_checked, set_checked); | ||||
|     REGISTER_BOOL_PROPERTY("checkable", is_checkable, set_checkable); | ||||
|     REGISTER_BOOL_PROPERTY("exclusive", is_exclusive, set_exclusive); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Karol Kosek
						Karol Kosek