mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 19:20:05 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			20 lines
		
	
	
	
		
			1.4 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
	
		
			1.4 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| #pragma once
 | |
| 
 | |
| #define SCWX_SETTINGS_ENUM_VALIDATOR(Type, Iterator, ToName)                   \
 | |
|    [](const std::string& value)                                                \
 | |
|    {                                                                           \
 | |
|       for (Type enumValue : Iterator)                                          \
 | |
|       {                                                                        \
 | |
|          /* If the value is equal to a lower case name */                      \
 | |
|          std::string enumName = ToName(enumValue);                             \
 | |
|          boost::to_lower(enumName);                                            \
 | |
|          if (value == enumName)                                                \
 | |
|          {                                                                     \
 | |
|             /* Regard as a match, valid */                                     \
 | |
|             return true;                                                       \
 | |
|          }                                                                     \
 | |
|       }                                                                        \
 | |
|                                                                                \
 | |
|       /* No match found, invalid */                                            \
 | |
|       return false;                                                            \
 | |
|    }
 | 
